You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Quick start - A brief example of processing data of the "Greater London"](#quick-start)
22
-
23
-
1.[Download data](#download-data)
24
-
25
-
2.[Read/parse data](#read-parse-data)
26
-
27
-
2.1 [.osm.pbf](#pbf-data)
28
-
29
-
2.2 [.shp.zip / .shp](#shp-zip-data)
30
-
31
-
3.[Import and retrieve data with a PostgreSQL server](#import-retrieve-data)
32
-
33
-
3.1 [Import the data to the database](#import-the-data-to-the-database)
34
-
35
-
3.2 [Retrieve data from the database](#retrieve-data-from-the-database)
36
-
37
-
3.3 [Import data of all subregions of a given (sub)region to the database](#import-data-of-all-subregions)
21
+
*[*1.* Download data](#download-data)
22
+
*[*2.* Read/parse data](#read-parse-data)
23
+
*[*2.1* .osm.pbf](#pbf-data)
24
+
*[*2.2* .shp.zip / .shp](#shp-zip-data)
25
+
*[*3.* Import and retrieve data with a PostgreSQL server](#import-retrieve-data)
26
+
*[*3.1* Import the data to the database](#import-the-data-to-the-database)
27
+
*[*3.2* Retrieve data from the database](#retrieve-data-from-the-database)
28
+
*[*3.3* Import data of all subregions of a given (sub)region to the database](#import-data-of-all-subregions)
38
29
*[Copyright & License](#footnote)
39
30
40
31
---
@@ -81,7 +72,7 @@ For a quick start, some examples are provided below, which demonstrate a few cor
81
72
82
73
83
74
84
-
### 1. Download data <aname="download-data"></a>
75
+
### *1.* Download data <aname="download-data"></a>
85
76
86
77
To download the OSM data for a region (or rather, a subregion) of which the data extract is available, you need to specify the name of the region (e.g. "Greater London"):
87
78
@@ -133,13 +124,13 @@ The *.pbf* data file will then be saved to the `download_dir` as specified.
133
124
134
125
135
126
136
-
### 2. Read/parse data <aname="read-parse-data"></a>
127
+
### *2.* Read/parse data <aname="read-parse-data"></a>
137
128
138
129
The package can read/parse the OSM data extracts in both *.pbf* and *.shp.zip* (and *.shp*).
139
130
140
131
141
132
142
-
#### 2.1 .osm.pbf data <aname="pbf-data"></a>
133
+
#### *2.1* .osm.pbf data <aname="pbf-data"></a>
143
134
144
135
Parsing the *.pbf* data relies mainly on [GDAL/OGR](https://pypi.org/project/GDAL/), using `read_osm_pbf()` function.
145
136
@@ -178,7 +169,7 @@ If `update=False`, when you run `read_osm_pbf(subregion_name)` again, the functi
178
169
179
170
180
171
181
-
#### 2.2 .shp.zip / **.shp** data <aname="shp-zip-data"></a>
172
+
#### *2.2* .shp.zip / **.shp** data <aname="shp-zip-data"></a>
182
173
183
174
You can read the *.shp.zip* and *.shp* file of the above `subregion_name` (i.e. 'London') by using `read_shp_zip()`, which relies mainly on [GeoPandas](http://geopandas.org/):
184
175
@@ -228,7 +219,7 @@ print(default_fp_)
228
219
229
220
230
221
231
-
### 3. Import and retrieve data with a PostgreSQL server <aname="import-retrieve-data"></a>
222
+
### *3.* Import and retrieve data with a PostgreSQL server <aname="import-retrieve-data"></a>
232
223
233
224
The package provides a class, named "OSM", which communicates with [PostgreSQL](https://www.postgresql.org/) server.
234
225
@@ -252,7 +243,7 @@ If the database "osm_pbf_data_extracts" does not exist before the connection is
252
243
253
244
254
245
255
-
#### 3.1 Import the data to the database <aname="import-the-data-to-the-database"></a>
246
+
#### *3.1* Import the data to the database <aname="import-the-data-to-the-database"></a>
256
247
257
248
To import `greater_london` (i.e. the parsed .pbf data of "London") to the database, "osm_pbf_data_extracts":
258
249
@@ -266,7 +257,7 @@ Each element (i.e. layer) of `greater_london` will be stored in a different sche
266
257
267
258
268
259
269
-
#### 3.2 Retrieve data from the database <aname="retrieve-data-from-the-database"></a>
260
+
#### *3.2* Retrieve data from the database <aname="retrieve-data-from-the-database"></a>
#### 3.3 Import data of all subregions of a given (sub)region to the database <aname="import-data-of-all-subregions"></a>
294
+
#### *3.3* Import data of all subregions of a given (sub)region to the database <aname="import-data-of-all-subregions"></a>
304
295
305
296
Find all subregions (without sub-subregions) of a (sub)region. For example, to find [all subregions](https://download.geofabrik.de/central-america.html) of "Central America":
0 commit comments