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

Adds a toggle to allow shape files with no dbf #41

Open
wants to merge 1 commit into
base: 3.1.x
Choose a base branch
from

Conversation

JoolsMcFly
Copy link
Contributor

Hi.

This PR fixes #36 as it gives users the ability to process a shape file with no matching dbf file.
A call to $shp->setAllowNoDbf(true); does the trick.

I left open the PR targeting master because 3.1.x and master branches are different enough (no psalm, use of ShapeFile enum etc) to have me change code from my first PR to make it work in 3.1.x.

Thanks for reviewing.

@JoolsMcFly JoolsMcFly marked this pull request as draft November 19, 2024 21:47
@JoolsMcFly JoolsMcFly marked this pull request as ready for review November 19, 2024 22:04
@@ -326,8 +334,16 @@ public function getIndexFromDBFData(string $field, $value): int
*/
private function loadDBFHeader(): array
{
$DBFFile = fopen($this->getFilename('.dbf'), 'r');
if (! self::supportsDbase()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved this block from loadHeaders so no matter where this method is called then we'll always check for support for dbase.

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.

1 participant