GPS Coordinates and GeoJSON: Order, Precision, and Clean Features
Maps APIs consume structured JSON—small mistakes in coordinate order or precision show up as points in the ocean. Treat geodata like any other contract: validate schemas, pretty-print for review, and document units.
GeoJSON grammar in brief
Feature collections wrap geometry objects with properties—keep CRS assumptions explicit when mixing WGS84 with local projections. Validate with JSON Schema or dedicated geospatial linters.
XML gateways and mixed stacks
Legacy feeds may arrive as GML or SOAP—see XML and JSON integration for transformation pitfalls before you emit GeoJSON to browsers.
Units and numeric hygiene
Heights, speeds, and distances need consistent SI or imperial choices—apply unit conversion precision rules so rounding policy matches your risk tolerance.
Polygons, winding order, and holes
Exterior rings should be counter-clockwise on the sphere per RFC 7946—get winding wrong and fill algorithms invert. Holes need correct nesting; validate with tools before shipping to mobile clients that rely on GPU triangulation.
CRS and projections in APIs
GeoJSON is lon/lat in WGS84 unless you extend with a CRS object—Mapbox and PostGIS helpers assume EPSG:4326. When you must use Web Mercator, transform at the boundary, not ad hoc in the browser.
Privacy and coarse geolocation
Exact coordinates can identify homes—round or grid-snapped values for analytics dashboards. Pair with synthetic data guidance when demo maps use fake cities.
Recommended tools
Sample coordinates for fixtures and demos.
Pretty-print FeatureCollections for review.
Convert distances and heights consistently.
Drop repeated coordinate pairs from imports.
Related guides
Frequently Asked Questions
What order is lon/lat in GeoJSON?
GeoJSON positions are [longitude, latitude] arrays—opposite of casual “lat, long” speech—get the order right or maps misplace points.
Should I store floats or integers?
Store enough precision for your domain—rounding errors accumulate; use decimal types and explicit rounding rules.
How do units tie in?
Heights may be meters or feet—align with unit conversion discipline when mixing systems.
Why dedupe coordinate lists?
Duplicate vertices inflate polygons and confuse diff tools—clean data before publishing tiles or APIs.
What is WGS84 vs other datums?
Consumer GPS usually reports WGS84 lat/lon—transform before mixing with legacy survey data or you will plot meters off.
How precise should coordinates be in APIs?
Match precision to use case—six decimal degrees is roughly meter-level; more digits imply false accuracy.
Wrapping up
GeoJSON rewards precision and pedantry—longitude first, validate often, and keep units boringly consistent.
GPS Generator →