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

Required member "properties" missing from feature objects #15

Closed
grovduck opened this issue Jul 2, 2018 · 6 comments
Closed

Required member "properties" missing from feature objects #15

grovduck opened this issue Jul 2, 2018 · 6 comments

Comments

@grovduck
Copy link

grovduck commented Jul 2, 2018

Tremendous resource. Thank you for this ...

I just downloaded the DC example and, in looking at the GeoJSON, all feature objects are missing the member "properties" as a requirement (at least according to the GeoJSON spec 3.2).

A Feature object has a member with the name "properties". The value of the properties member is an object (any JSON object or a JSON null value)

I know at least http://geojson.io is throwing an error with the GeoJSON files:

Invalid JSON file: TypeError: Cannot convert undefined or null to object

Any possibility of adding "properties":{} to each feature object?

@mikelmaron
Copy link

@grovduck I had luck using jq

jq '.features[] = (.features[] + {"properties": {}})'

@grovduck
Copy link
Author

grovduck commented Jul 2, 2018

@mikelmaron, that is very cool. I hadn't run across jq before. I'll leave the issue open for now just in case there is desire to conform to the GeoJSON spec, but this is a great workaround.

@mikelmaron
Copy link

Spoke too soon. That jq command works on a small file, but still grappling with gettin jq to work on a large file....

@worace
Copy link

worace commented Jul 9, 2018

👍 to this issue -- it is a minor request but would be great if future releases included the properties key.

@mikelmaron you might have better luck using 2 separate jq steps, one to extract the features and one to add the properties key. I think the way listed above requires loading all of the data into memory and doing updates in place, which takes a lot of RAM for the bigger files. The above command didn't finish for me on the CA dataset after several minutes, whereas this ran in about 4 minutes:

jq -cr .features[] California.json | jq -cr ". + {\"properties\": {}}" | wc -l
10556550

@jharpster
Copy link
Contributor

This is updated at the 1.1 release.

@antifa-ev
Copy link

@nitrif The error from #30 has vanished, but now all the GeoJSON segfault tippecanoe when they exceed 49.9 % progress. See also mapbox/tippecanoe#608

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

No branches or pull requests

5 participants