4. Geo Search & Clustering

🏡 Home 👈 Prev 👉 Next

What's What

Geographical objects and shapes are supported in ES through these field types:
  1. GEO POINTS latitude/longitude pairs or geo hashes. Primarily used for:
      • and sorting documents by distance.
  1. GEO SHAPES select GeoJSON and WKT entities. Used for:
      • filtering geo_shape documents using the spatial relations INTERSECTS, DISJOINT, WITHIN, or CONTAINS
  1. SHAPES arbitrary x, y cartesian shapes Only available within X-Pack — a closed-source collection of features that's part of an official Elasticsearch Subscription.
The third dimension (z-value) in any of the above field types is also accepted but only the latitude and longitude values will be indexed — the third dimension is ignored!

Coordinate Accuracy & Precision

People often ask how many coordinate decimal places they should store.
Let's clarify that by borrowing from this GIS Stack Exchange thread and this answer by whuber:
  • Accuracy is the tendency of your measurements to agree with the true values.
  • Precision is the degree to which your measurements pin down an actual value.
I'm not going to get into the accuracy part and will rather focus on precision — here's a summary of what each digit in a decimal degree signifies:
  • The sign tells us whether we are north or south, east or west on the globe (+ N/E, - S/W).
  • A nonzero hundreds digit tells us we're using longitude, not latitude! See below — the x-axis represents the longitude, the y-axis the latitude:
                               North (+90)
                     (-180) West ---+--- East (+180)
                                South (-90)
Cardinal Directions

Already purchased? Sign in here.