OpenStreetMap Public Dataset on Google Cloud Platform with BigQuery SQL. OSM Layer Classifier

Due to the growing public interest in the analysis and visualization of various spatial models (for example, to study the spread of viruses), I recalled one of the projects that I was working on on the Upwork freelance platform. This work was commissioned by Google and consisted of creating a public OpenStreetMap dataset (OSM) on the Google Cloud Platform to work with it using Google BigQuery and creating some examples of OpenStreetMap data analysis (see Python Jupyter Notebooks in the repository). My part of the project was working with data; whoever wants to see the code right away - welcome to my bigquery-openstreetmap git repository. Further I will tell you what the advantages of the created dataset are (hint: the SQL classifier is implemented and available) and how it can be used.


Message to readers: please do not hesitate to discuss Upwork, in particular, and freelance in the comments, but I’m tired of it, right word ... there are different projects there.


Road Usage Patterns analysis, Boston Area


Boston Road Network Analysis Results from OpenStreetMap Highways with high Betweenness centrality (bc) are highlighted in red, streets with high bc are high in green, low bc is high in yellow, and low bc in gray.


Instead of introducing


If there is time and interest in the topic of working with OSM, I could talk about building complex routing using PostgreSQL / PostGIS / PgRouting - how to provide unidirectional road support for the traveling salesman problem, TSP), , ( ) β€” OSM. ( , , ) β€” 5-10 ( ), ( 100) , ("") . , SQLite3 Spatialite ( PostgreSQL/PostGIS/PgRouting) PostgreSQL/PostGIS .


OpenStreetMap


OpenStreetMap:


OpenStreetMap ( Β« Β»), OSM β€” - β€” .

, OSM , . , , β€” OSM . , Google Maps API/Bing Maps API , , ( , , ). , OSM . , , , ( , , , , ...), , - OSM , - , . , , , OpenStreetMap License.


OpenStreetMap , , . , OSM ( ) β€” , ( : ). OSM ("OSM uses different database schemas for different applications"). , - ( web database schema) (, , ). "" "" 10 , (Simple schema for Osmosis) β€” ( ). : Database Schemas , :


Schema nameCreated withUpdatableGeometries (PostGIS)Losslesshstore columnsDatabase
pgsnapshotosmosisyesoptionalyesyesPostgreSQL
ogr2ogrogr2ogrnoyesnooptionalvarious
overpassOverpass APIyes?yes?custom
mongosmMongOSMmaybe???MongoDB
node-mongosmMongoosejsyesyesyesNAMongoDB
goosmgoosmnoyesyesNAMongoDB
pbf2mongopbf2mongonoyesyesNAMongoDB

ogr2ogr , . , , , PostgreSQL/PostGIS. pgsnapshot, osmosis β€” - , , ogr2ogr. verpass ( web API) . , MongoDB, "" , .


(ogr2ogr) ogr2ogr (osmconf.ini). , , , β€” , ( ), ( , ). OSM β€” , ( "relation") ( "node"). , , . . ogr2ogr , . osmconf.ini


OSM . β€” , … β€” , OSM , , , β€” ( ). , . " " β€” OSM wiki , ( , , , ). , OpenStreetMap Data in Layered GIS Format GEOFABRIK. , OSM, , , BigQuery SQL .


, "" ogr2ogr OSM GEOFABRIK. OpenStreetMap Public Dataset Google BigQuery ( SQL). , OSM β€” OSM bigquery-openstreetmap.



- , BigQuery SQL . , SQL . , β€” OSM , . " " , ("ignore incorrect geometries with wrong orientation (see GeoJSON RFC 7946)"). CSV .


Laptop with an example of calculating and animating the distance of buildings to the nearest park in New York city ​​parks2buildings_distance_NY.ipynb :



A laptop with an example of calculating and animating the distance of buildings to the nearest park in Tokyo parks2buildings_distance_Tokyo.ipynb :



For those who have read - see the laptop. The results of the analysis of the Boston city road network as an example of working directly with OSM data - and this is also possible.


All Articles