Zanzibar Typology QGIS Map Guidelines

From OpenStreetMap Wiki
Jump to navigation Jump to search

There is a QGIS project that connects to a sqlite database to render all OSM data.

It contains map layers of:

  1. Architectural Typology
  2. Architectural Style
  3. Building Condition
  4. Urban Typology
  5. A base layer with roads and building outlines


JOSM File

In Josm download the area you want to turn into a map. The whole Ng'ambo area is too big to download at once (especially if you include Stone Town). You can download different pieces. For this, just move the map around, and re-press the download button. The download tool will draw a square over the visible area for you. Once you have selected several areas, they show as seperate layers in the layer tool.

Select one layer, and in the Edit menu, choose 'Merge Layers'. Merge all your layers until there is 1 left.

Then, in the File menu, select 'Save As...' and save all the data as a file, eg. Ngambo.josm

This .josm file is the input for the next step in QGIS.

SQLite Database

You need to (re) create the database to get the latest information. There is a Nice tutorial on LearnOSM that explains how this works.

The database file should be called Ngambo.osm.db and be located in the same folder as the QGIS project file.

You need to export 3 topologies to SQLite.

buildings

Call the table 'buildings', Export type is 'Polygons'.

Click the 'Load from Database button, and select the following fields:

  1. addr:city
  2. addr:country
  3. addr:housename
  4. addr:housenumber
  5. addr:postcode
  6. addr:street
  7. alt_name
  8. amenity
  9. architect
  10. building
  11. building:architecture
  12. building:architecture:historic
  13. building:architecture:typology
  14. building:colour
  15. building:condition
  16. building:levels
  17. building:material
  18. building:structure
  19. historic
  20. name
  21. office
  22. old_name
  23. religion
  24. roof:colour
  25. roof:material
  26. roof:shape
  27. roof:structure
  28. shop
  29. start_date
  30. tourism
  31. website
  32. wikipedia
  33. wikidata

roads

Call the table 'roads', Export type is 'Polylines'.

Click the 'Load from Database button, and select the following fields:

  1. "highway" > Check 'Not Null'
  2. "name"
  3. "smoothness"
  4. "surface"
  5. "barrier"
  6. "width"

waterways

Call the table 'roads', Export type is 'Polylines'.

Click the 'Load from Database button, and select the following fields:

  1. "waterway" > Check 'Not Null'
  2. "name"

urbantypologies

Call the table 'urbantypologies', Export type is 'Polygons'.

Click the 'Load from Database button, and select the following fields:

  1. "urban:typology" > not null


naturalareas

Call the table 'naturalareas', Export type is 'Polygons'.

Click the 'Load from Database button, and select the following fields:

  1. "natural" > not null
  2. name

leisureareas

Call the table 'leisureareas', Export type is 'Polygons'.

Click the 'Load from Database button, and select the following fields:

  1. "leisure" > not null
  2. name
  3. sport

tourismareas

Call the table 'tourismareas', Export type is 'Polygons'.

Click the 'Load from Database button, and select the following fields:

  1. "tourism" > not null
  2. name

landuse

Call the table 'landuse', Export type is 'Polygons'.

Click the 'Load from Database button, and select the following fields:

  1. "landuse" > not null
  2. name

shops

Call the table 'shops', Export type is 'Points'.

Click the 'Load from Database button, and select the following field:

  1. "shop" > not null


trees

Call the table 'trees', Export type is 'Points'.

Click the 'Load from Database button, and select the following fields:

  1. "natural" > not null
  2. leaf_type
  3. circumference
  4. height
  5. genus
  6. leaf_cycle

Buildings with Shops

Unless there is a very clear mixed usage of a building (say: floor 1 is shop, floor 2 is hotel) we tag the main building with the main functonality and then add POI shop= (mostly) to indicate little shops or windows from which items are sold. In order to display this, we need to generate a new shapefile.

  1. Click Vector > Data Management Tools > Join Attributes by Location
  2. In the first field select 'Buildings'
  3. In the second field select 'Shops'
  4. Select 'take attributes of the first located feature'
  5. Create the file 'BuildingWithShops\BuildingWithShops.shp' where 'BuildingWithShops' is a subfolder from where the QGIS project is
  6. Select 'Keep all records (etc.)
  7. Click OK
  8. Don't add the layer when suggested, it is already there.

You might have to save the project and re-open to see the new data.

If you delete this layer, you need to re-add this flter:

("building" LIKE '%;%' AND "building" != 'commercial') OR ("shop" IS NOT NULL AND "building" != 'commercial')  OR ("shop_2" IS NOT NULL AND "building" != 'commercial')

ToDo

  1. Create proper Print Composers
  2. Create black & white print Styles
  3. Create 1 (python?) script that downloads the OSM file and completely regenerates the new sqllite db file.


Open Issues

Data Ranges

To store the dates of contruction we use the Date namespace on construction=*. During transformation of the data from .osm to sqlite format the result of this is that every namespace generates one column (if selected). This is impossible to work with. Suggestion: Write a script that processes the .osm file and transforms contruction:1960-1970 formatted keys into 2 columns contructon_start and contruction_end with the respective values.