geojson-primer

GitHub Repo Source GitHub vscode.dev

🛠️ GeoJSON Primer

A primer1 on GeoJSON tools you can use with Visual Studio Code.

🔨Visual Studio Code Extensions

[GeoJSON.IO for VSCode] : https://marketplace.visualstudio.com/items?itemName=swallow.geojson-io-for-vscode “Create, Edit and Preview GeoJSON Data In VSCode”

[Rainbow CSV] : https://marketplace.visualstudio.com/items?itemName=mechatroner.rainbow-csv “Highlight CSV and TSV files”


GeoJSON Data

🔧 Creating GeoJSON

[geojson-random] : https://www.npmjs.com/package/geojson-random “Generate random GeoJSON features”

Generate three random GeoJSON features

geojson-random 3  > 3.geojson

🖋️ Prettier

[prettier] : https://www.npmjs.com/package/prettier “Prettier is an opinionated code formatter”

Make a GeoJSON file ‘prettier’ or easier to read

prettier --write 3.geojson

🪚 Converting GeoJSON

[geojson2csv] : https://www.npmjs.com/package/geojson2csv “converting a geojson file to a csv file”

Convert GeoJSON to CSV

geojson2csv data/parks.geojson

🗜️ Precision for GeoJSON

[geojson-precision-ts] : https://www.npmjs.com/package/geojson-precision-ts “Remove meaningless precision from GeoJSON”


⚙️ Validate GeoJSON

[@mapbox/geojsonhint] : https://www.npmjs.com/package/@mapbox/geojsonhint “complete, fast, standards-based validation for geojson”

Use @mapbox/geojson to look for hints on your GeoJSON

geojsonhint 3.geojson

or, use @placemarkio/check-geojson to look to check your GeoJSON

geojson-check 3.geojson

🔬 Visualizing GeoJSON

From the command line, you can push your GeoJSON to a browser that can help you visualize your GeoJSON.

[geojsonio-cli] : https://www.npmjs.com/package/geojsonio-cli “Use the command line to open GeoJSON”

Visualize at GeoJSON.io

# from a command line, open GeoJSON on disk
geojsonio data/parks.geojson

Visualize with NPS Park Tiles

# Pass in the domain of where to open your GeoJSON
geojsonio data/parks.geojson --domain=https://roblabs.com/geojson

About

Created in summer 2024 as a way to teach others how to use GeoJSON, Node, and Visual Studio Code. Use the random tools to generate GeoJSON. Use ‘prettier’ to format GeoJSON. Methods to convert GeoJSON properties to CSV for further inspection.

ˈprimər, noun “an elementary textbook that serves as an introduction to a subject of study or is used for teaching children to read”

🔝