diff --git a/README.md b/README.md index 4fc48c6..d6187b6 100644 --- a/README.md +++ b/README.md @@ -7,20 +7,18 @@ Makes OpenStreetMap cutouts from the larger USA data set. * [docker](https://www.docker.com/) * [node.js](https://nodejs.org/en) -## Usage - -Add a geojson file that contains a Feature into the `./polygons` directory, add a corresponding entry in `./config.json`, then build and run the docker container. - -Follow the steps below to use the tool to create your own cutouts. The San Francisco Bay Area consists of nine counties; they are used in the following example. - 1. If you do not plan to run this locally, skip this step. Find and download the smallest `.osm.pbf` file that includes the entire area you want to extract from [Geofabrik's download page](https://download.geofabrik.de/north-america/us.html) (This example uses the Northern California file). This may take a while, so you can start this download, then move on to the next steps. ``` curl 'https://download.geofabrik.de/north-america/us/california/norcal-latest.osm.pbf' -o ./volumes/input/latest.osm.pbf ``` -2. Decide what counties you want to include in your OSM cutout. Find each county in [counties-usa.geojson](counties-usa.geojson), confirm spelling, capitalization, etc... -3. Add all of the counties you want in your extract as a comma seperated list in the follow command, replacing `Alameda,Contra Costa,Marin,Napa,San Mateo,Santa Clara,Solano,Sonoma,San Francisco`. Set the name of the output file (replacing `bay-area-geometry.geojson` with something that makes sense). Then run it. This should create a geojson file in the `./polygons` directory. +2. Decide which counties you want to include in your OSM cutout. Find each county in [counties-usa.geojson](counties-usa.geojson), confirm spelling, capitalization, etc... +3. Add all the counties you want in your extract as a comma seperated list in the following command, e.g. `Alameda,Contra Costa,Marin,Napa,San Mateo,Santa Clara,Solano,Sonoma,San Francisco`. Set the name of the output file. Then run it. This should create a geojson file in the `./polygons` directory. ``` -npx --yes mapshaper -i counties-usa.geojson -filter '"Alameda,Contra Costa,Marin,Napa,San Mateo,Santa Clara,Solano,Sonoma,San Francisco".indexOf(NAME) > -1' -dissolve2 -o ./polygons/san-francisco-bay-area.geojson geojson-type=Feature +npx --yes mapshaper \ + -i counties-usa.geojson \ + -filter '"{list-of-comma-separated-county-names}".indexOf(NAME) > -1' \ + -dissolve2 \ + -o ./polygons/{my-region-name}.geojson geojson-type=Feature ``` 4. (optional) Create a convex hull of the counties. This is useful when the group of counties don't make a solid shape. Use the geojson file created in the previous step to make a new geojson file. ``` @@ -33,5 +31,11 @@ docker build . -t osm-extractor:testing-new-extract ``` 7. (test) Generate the extract by running the docker container. This should create a new .pbf file in `./volumes/output`. ``` -docker run -v ./volumes/output:/mnt/output -v ./volumes/input:/mnt/input osm-extractor:testing-new-extract osmium extract -d /mnt/output -c /app/config.json /mnt/input/latest.osm.pbf +docker run \ +-v ./volumes/output:/mnt/output \ +-v ./volumes/input:/mnt/input \ +osm-extractor:testing-new-extract osmium extract \ + -d /mnt/output \ + -c /app/config.json \ + /mnt/input/latest.osm.pbf ```