GeoPython Workshop Plan

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche

Getting the Data

  • Admin 0 - Countries from Natural Earth.
  • Populated Places (Simple) from Natural Earth.
  • Rapperswil from OSMaxx? (for selecting and labelling features based on OSM tags using the hstore functions)

Custom Python Expression Functions Use Cases

Following are some example ideas to implement the use cases defined in the Discussion

  • Select by Expression
- Select all the capital cities with population greater than a user-defined number. select_populated_capitals(input_pop)
- Select points based on their UTM Zone (maybe not, since the QGIS tutorial already covers it)? get_utm_zone()
- Use the hstore functions to select all points with the tags amenity=restaurant or amenity=schools etc. from the Rapperswil data. Similarly, label the points as 'name | restaurant' or 'name | school' ?
  • Field Calculator
Use Nominatim's reverse geocoder to find the full address for that latitude longitude. Write a Python function that uses the API. See Nominatim wiki and the example: http://nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&lon=-1.81602098644987&zoom=18&addressdetails=1. get_address()
  • Get the value of the env variable and do something with it
- Get the layer_name or layer_id of the Countries layer using get_env().
- Set a new variable (eg. layer_colour) using the set_env() function.
  • Label using Expression functions
- Label all the points in the 'Populated Places' layer as 'name, ISO country code, population_growth', where population_growth = pop_max/pop_min.
- Label all the points in the 'Populated Places' layer as 'name, ISO country code, hemisphere' where 'hemisphere' which can be North or South depending on the latitude value.