Skip to content

Instantly share code, notes, and snippets.

@eczajk1
Last active March 4, 2019 01:59
Show Gist options
  • Save eczajk1/55c027b4ad088b7dfa8a113b1171dfc8 to your computer and use it in GitHub Desktop.
Save eczajk1/55c027b4ad088b7dfa8a113b1171dfc8 to your computer and use it in GitHub Desktop.

Railroad Crossings

Original dataset (comma separated values, CSV) was downloaded from https://safetydata.fra.dot.gov/officeofsafety/publicsite/downloaddbf.aspx

The following ogr2ogr script converts the CSV file to GeoJSON, keeping several attributes that we wished to use for styling:

ogr2ogr -f "geojson" \
  crossings-5.geojson \
  CI_Crossings.csv -oo X_POSSIBLE_NAMES=Longitude -oo Y_POSSIBLE_NAMES=Latitude \
  -select 'CrossingID,Railroad,TypeXing,XPurpose,PosXing' \
  -where 'Latitude is not null'

National Bridge Inventory

Original dataset was downloaded from https://hifld-geoplatform.opendata.arcgis.com/datasets/e02b036ccddf4a1a8f83b329940b41be_0

The following ogr2ogr script converts the shapefile to GeoJSON, keeping only the geometries (points) and YEARBUILT attributes:

ogr2ogr -f "geojson" \
  bridges-03.geojson \
  ./bridges/National_Bridge_Inventory_NBI_Bridges.shp \
  -sql 'SELECT ITEM27 as YEARBUILT FROM National_Bridge_Inventory_NBI_Bridges'

From the geojson file, a Vector Tile dataset was created using tippecanoe via the following script:

tippecanoe -z9 -o bridges-01.mbtiles --drop-densest-as-needed --extend-zooms-if-still-dropping bridges-03.geojson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment