-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Geospatial Development By Example with Python
By :

Now that we have our database populated with some data, it's time to get some information from it; let's explore what kind of information all those POIs hold. We know that we downloaded points that contain at least one of the amenity
or store
keys.
Amenities are described by OSM as any type of community facilities. As an exercise, let's see a list of amenity types that we got from the points:
Edit your geodata_app.py
file's if __name__ == '__main__':
block:
if __name__ == '__main__': amenity_values = Tag.objects.filter( key='amenity').distinct('value').values_list('value') for item in amenity_values: print(item[0])
Here we take the Tag
model, access its manager (objects), then filter the tags whose key='amenity'
. Then we separate only distinct values (exclude repeated values from the query). The final part—values_list('value')
—tells Django that we don't want it to create Tag
models, we only want a list of values.
Run the code...
Change the font size
Change margin width
Change background colour