Skip to content

Commit

Permalink
fix: Add section on importing the data into postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Jul 12, 2023
1 parent 55a32c1 commit 433eaa4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docs/make_data_extract.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ ways, but needed to be automated to be used for FMTM.
-c {buildings,amenities}, --category {buildings,amenities}
Which category to extract


## Examples

### Postgres Database:
Expand All @@ -41,6 +40,26 @@ data by default. The size of the extracted data can be limited using
the _--boundary_ option. The program outputs the data in GeoJSON
format.

For raw OSM data, the existing country data is downloaded from [GeoFabrik](
https://download.geofabrik.de/index.html), and imported using a
modified schema for osm2pgsql. First create the database and install
two postgres extensions:

# createdb nigeria
psql -d nigeria -c "CREATE EXTENSION postgis"
psql -d nigeria -c "CREATE EXTENSION hstore"

And then import the OSM data.

> osm2pgsql --create -d nigeria --extra-attributes --output=flex --style raw.lua nigeria-latest-internal.osm.pbf
The *raw.lua* script is [available
here](https://github.com/hotosm/underpass/blob/master/utils/raw.lua). It's
part of the [Underpass
project](https://hotosm.github.io/underpass/index.html). It uses a
more compressed and efficient data schema.


### Example:

./make_data_extract.py --postgres -dn colorado --boundary mycounty.geojson -g mycounty_buildings.geojson
Expand Down

0 comments on commit 433eaa4

Please sign in to comment.