Is there a best way to determine the number of features in a GeoJSON file?
Ideally using Python or JavaScript.
Is there a best way to determine the number of features in a GeoJSON file? Ideally using Python or JavaScript. |
||||
|
If you have GeoJson that looks like that on the wikipedia page
then all you need to do is:
as this is a native Javascript object and so the embedded feature array has a length property, which in this case is 3. If you want to do this in Python, you can use json.loads(your_json) see https://docs.python.org/2/library/json.html, which will parse the json into dictionaries and lists, so you can again get the value of the length of the list containing the features. |
||||
|
In Python:
|
|||||
|