Skip to content

Commit

Permalink
Genericize mapshaper sample command.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsarathy committed May 22, 2024
1 parent 79bb696 commit 6d0fc7a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ Follow the steps below to use the tool to create your own cutouts. The San Franc
```
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.
```
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
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 '"{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.
```
Expand Down

0 comments on commit 6d0fc7a

Please sign in to comment.