# GeoLocation


# Description

GeoLocations are used in 1search to categorise items by their location. They can also be used by a user to sort results in order of distance from the user. Each GeoLocation in 1search is defined within the <GeoLocations> tag.

A POI refers to a location of significance (e.g. the name of a suburb) that will be mapped to a GeoLocation coordinate. See POIs to learn more.

# Syntax

<GeoLocations>
    <GeoLocation Name="string" Func="string">
        <SortIndex Name="string"/>
    </GeoLocation>
</GeoLocations>

# Attributes

Note: attributes marked with * are required.

Attributes within <Geolocation> include:

  • Name* (string) :
    • The name of the Geolocation. This value must be unique across all other GeoLocation indexes.
  • Func* (string) :
    • The name of the function that will return your GPS coordinates for the GeoLocation.
  • Key (string) Replaces Func:
    • You may choose to use key to specify a JSON path in place of a function if the data you are providing is suitable.

Attributes within <SortIndex> include:

  • Name* (string) :
    • The name of the SortIndex you wish to implement. SortIndexes can be added within a <GeoLocation> tag

NOTE

A GeoLocation's functions keys must be reflected in the JSON data being uploaded otherwise you will not be able to find it when making requests using a query that contains location.location(Lat,Longx#km) or POI.POI(POIx#km). For example,

XML

<Tuple Name="GeoLocationTuple">
  <Value Name="Latitude" Key="GeoLocation.Latitude"/>
  <Value Name="Longitude" Key="GeoLocation.Longitude"/>
</Tuple>

The Keys/JSON paths used here must be reflected in the JSON data being uploaded

{
  "GeoLocation": {
    "Latitude": -35.279236,
    "Longitude": 149.118362
  }
}