Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not write SHP files that are over 2GB. Fix #42. #45

Merged
merged 2 commits into from
Jun 30, 2024

Conversation

KubaSzostak
Copy link
Member

Handle 2GB shapefile limits.

There is a 2 GB size limit for any shapefile component file, which translates to a maximum of roughly 70 million point features. The actual number of line or polygon features you can store in a shapefile depends on the number of vertices in each line or polygon (a vertex is equivalent to a point).
Esri Documentation

@@ -70,6 +70,9 @@ public void Write()
ShpStream.WriteShpRecordHeader(RecordNumber, (int)Buffer.Length);
ShpStream.WriteAllBytes(Buffer);

Shapefile.ValidateComponentSize(ShxStream.Length);
Shapefile.ValidateComponentSize(ShpStream.Length);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a similar check be done for the dbf?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I will add appropriate check.

@KubaSzostak KubaSzostak merged commit 64e9475 into develop Jun 30, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants