Skip to content
Web Design & Development

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.

Marcus Adeyemi Technical Director 2 min read 22 views
Geospatial Data in Web Apps: The Decisions That Matter

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?

  1. Use database spatial types and indexes
  2. Store coordinates consistently and document the order
  3. Model service areas as polygons where they are not circular
  4. Validate addresses before geocoding
  5. Cache geocoding results
What to do and what to avoid with geospatial data in web apps, side by side
Good practice against the usual mistakes, from the sources listed below.

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

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.

All services

The work behind this article, and what it costs.

Marcus Adeyemi

Builds and maintains the web work. Writes about front-end architecture, performance, accessibility and the unglamorous parts of keeping a site alive.

Keep reading

More in Web Design & Development