Geospatial Data in Web Apps: The Decisions That Matter
Storing and querying locations, areas and distances in applications such as store locators and delivery zones.
Why does it matter?
Location queries are slow and wrong without spatial indexes and the right coordinate handling.
What are the numbers?
- Coordinate order latitude and longitude order differs between systems
- Spatial indexes make distance and containment queries fast
- Projections distance calculations depend on the projection used
- Boundaries service areas are polygons, not radii
What should I do?
- Use database spatial types and indexes
- Store coordinates consistently and document the order
- Model service areas as polygons where they are not circular
- Validate addresses before geocoding
- Cache geocoding results
What should I avoid?
Avoid:
- Distance calculated in application code over full tables
- Latitude and longitude swapped
- Radius searches for irregular service areas
- Geocoding the same address repeatedly
When should I get help?
Short answer Bring in help when location features slow down.
Where this comes from
- Microsoft Learn — Spatial data
- U.S. Census Bureau — TIGER/Line Shapefiles
The figures and practices above come from the sources listed.
Working on something like this?
We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.