2

Can someone explain the following python code.

value_geojson["features"][0]["properties"]["title"]

value_geojson is a geojson variable. I like to think that I'm not a total python newbie but these are too many [] for me. I am a GeoJSON newbie though.

Would appreciate help on that one, eventhough I know it's probably to simple for SE

Ethan
  • 1,657
  • 9
  • 25
  • 39
DGIS
  • 123
  • 4

1 Answers1

3

See sections 3.2 and 3.3 of the geojson standard.

It looks like value_geojson is a FeatureCollection object, which have a single member "features" which is a list of Feature objects. So

value_geojson["features"][0]

is now just the first Feature object. Those have a few members, including "properties", which is an arbitrary JSON object. At that point we're outside of the geojson standard, so whatever "title" means is more context-specific.

Ben Reiniger
  • 12,855
  • 3
  • 20
  • 63