Skip to content

Some files in Python to get in OpenStreetMap housenumbers from the dataset of Municipality of Trento

License

Notifications You must be signed in to change notification settings

danielezotta/osm_civici_trento

Repository files navigation

Importing Housenumbers into OSM from Trento municipality's dataset with Python 2.7

Here you can see how I did to get the housenumbers from the municipality of Trento into OpenStreetMap, verifing which are already in OpenStreetMap and deleting from the dataset.

Here are all the steps I made

  1. I got the dataset with the house numbers of Trento from the Open Data section of the Municipality website. The dataset is distributed with the terms of the CC0.
  2. I got the dataset with the house numbers of Trento from OpenStreetMap from the website Estratti OpenStreetMap. The file used is the shapefile addresses.shp archived on the zipfile 022205---Trento.zip
  3. I created a SQLite/Spatialite database and inserted the datasets creating 2 tables with Spatialite-gui. The projection used by the Municipality is the ETRS89 / UTM zone 32N EPSG:3044.
  4. I created a third table, based on the Municipality one, containing only "front entrance" (value "ingresso principale") numbers and discarding side entrances.
  5. I started to write some code in Python to do some exercises without Spatialite-gui
  6. Then I began to write the code to get common housenumbers from the two tables (get_common_numbers). To improve it I used the library pypostal to normalize the names.
  7. I cleaned the data with OpenRefine in order to remove housenumbers with different street names, from the output of get_common_numbers
  8. I checked and corrected manually the data inside OpenStreetMap
  9. Once refined the output file, I wrote the file delete_civici_comune to delete all the common housenumbers from the table
  10. I done another time from the 8th point, but this time with a bigger Buffer (50m - expressed with the projection EPSG:3044) for intersecting housenumbers that were at an higher distance
  11. Estracted in a CSV file (civici_osm.csv) all the OpenStreetMap housenumbers, then with the file osm_only_search I've isolated in a CSV file all the numbers not contained in the municipality's table
  12. I controlled by hand all the numbers in OpenStreetMap from the previous file, changed data where needed and deleted from the municipality table (to have no copies of the same housenumber)
  13. Managed to get all Municipality's street a corresponding one to OpenStreetMap, importing the roads datasets from both OpenStreetMap and the municipality, done with get_street_comuni primarily, secondly with get_street_names, and at the end with get_street_names_notinosm
  14. Wrote the import_osmapi in order to import the housenumbers into OpenStreetMap using osmapi for Python.

About

Some files in Python to get in OpenStreetMap housenumbers from the dataset of Municipality of Trento

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages