Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Using the geo_point facet type you can attach coordinates to data you load into Squirro, allowing you to display the coordinates on a map or query the data using a geo bounding box.

Data loading

To use a field as a geo location for filtering, in the facets mapping you need to define that field as "geo_point" type. The format of field is "latitude,longitude" (to remember, just follow alphabetic order: lat is before lon) for example: office_location: "47.37,8.54"

If you have multiple values for a location field then you can separate them by space, e.g. office_location:"47.37,2.17 41.38,8.54" and define the delimiter when loading the data. We allow to have multiple geo_point fields in an item, e.g home_location, office_location

Example of a geo_point facet field:

Code Block
	"office_location" : {
		"name" : "office_location",
		"data_type" : "geo_point",
		"searchable" : true,
		"visible" : false,
		"typeahead" : false,
		"group_name" : "Location",
		"delimiter": " "
	}
Tip
titleWorking with Coordinates

Use this tool to check coordinate of a place: https://www.latlong.net/. If you have a coordinates pair (lat,lon), you can copy-pase to maps.google.com to see where it is. e,g: https://www.google.ch/maps/place/47.37,8.54

Visualisation

Once you have data loaded containing geo_point facets, you can use the Map widget type in your dashboard.

Image Removed

Query syntax

To restrict the returned items to a specific geographic region you can apply field filter query. This geo filter value can take three different forms: ‘lat,lon’ for searching on one spot, ‘lat,lon,radius’ to search within a circle (radius unit is kilometer) or ‘lat1,lon1,lat2,lon2’ to search in an envelope.

For example:

To filter all items which have the field office_location is geo_point type, in the radius of 10km around coordinates 47.37,8.54: query=office_location:47.37,8.54,10

To filter all items in a bounding box 47.37,2.17 and 41.38,8.54 based on office_location field:  query=office_location:47.37,2.17,41.38,8.54

To filter all items which have  office_location or home_location in a radius 10km of given point:  office_location:47.37,8.54,10 OR home_location:47.37,8.54,10

Order of coordinates in a boudingbox

When doing geo filter query, e.g. location:lat1,lon1,lat2,lon2, we always confuse what are lat1,lon1,lat2,lon2? In elasticsearch, the order of envelope must be top_left,bottom_right.

Look at the example below, if you want to have an envelope (or bounding box)  to filter all locations between Zurich (47.37,8.54) (NorthEast) and Barcelona (41.38,2.17) (SouthWest) then the bounding box should be: top,left,bottom,right=big_lat,small_lon,small_lat,big_lon=NorthEast.lat,SouthWest.lon,SouthWest.lat,NorthEast.lon=47.37,2.17,41.38,8.54

Image Removed

Quick Tutorial

  1. Create a new project like "Earthquakes"
  2. Load earthquakes.xlsx via the Excel dataloader
  3. Facet configuration (see screenshot below)
    1. Configure the Geopoint field to be a facet of type Geo_point
    2. Configure Datetime field as a facet with the format "%A, %B %d, %Y %H:%M:%S %Z"
  4. Create a dashboard containing a Map widget and set it to use "Geopoint" as the facet

...

This page can now be found at Map Search and Visualizations on the Squirro Docs site.