-
Notifications
You must be signed in to change notification settings - Fork 9
Geo Management
A geo index allows you to perform geospatial queries. Geo indexes can be created on both XML and JSON documents. Because geo indexes require both a latitude and longitude value, there are numerous ways to specify where these values are in your documents. The supported configurations are outlined below.
When the same key or element holds both the latitude and longitude value, those values can be separated by whitespace or any punctuation except '+', '-' or '.'. By default, the first value is interpreted as the latitude value and the second value as the longitude. This behavior can be controlled via the comesFirst
parameter.
{
"title": "Golden Gate Bridge",
"location": "37.819722, -122.478611"
}
<photo>
<title>Golden Gate Bridge</title>
<location>37.819722, -122.478611</location>
</photo>
If there are multiple keys or elements in the document with the same name, you can provide a parent key or element to refine the selection.
{
"title": "Golden Gate Bridge",
"location": "San Francisco",
"geoInfo": {
"location": "37.819722, -122.478611"
}
}
<photo>
<title>Golden Gate Bridge</title>
<location>San Francisco</location>
<geoInfo>
<location>37.819722, -122.478611</location>
</geoInfo>
</photo>
- Endpoint:
/manage/geospatial/<geo-name>
- Request type: POST
- Paramaters: (note: one of
key
orelement
must be present, but not both)- key - The JSON key that holds both the latitude and longitude value
- element - The XML element that holds both the latitude and longitude value
- parentKey (optional) - A JSON key that is the parent of the actual key that holds the value
- parentElement (optional) - A XML element that is the parent of the actual element that holds the value
- coordinateSystem (default: wgs84) - The coordinate system to use, can be either wgs84 or raw
- comesFirst (default: latitude) - Specifies what value comes first, latitude or longitude
When the latitude and longitude are stored in separate keys or elements, those elements can be specified along with the parent element that contains them both.
{
"title": "Golden Gate Bridge",
"location" {
"latitude": "37.819722",
"longitude": "-122.478611"
}
}
<photo>
<title>Golden Gate Bridge</title>
<location>
<latitude>37.819722</latitude>
<longitude>-122.478611</longitude>
</location>
</photo>
- Endpoint:
/manage/geospatial/<geo-name>
- Request type: POST
- Paramaters: (note: one of
parentKey
orparentElement
must be present, but not both. Along with the corresponding latKey/longKey or latElement/longElement)- parentKey - A JSON key that is the parent of the actual keys that holds the values
- parentElement - An XML element that is the parent of the actual elements that holds the values
- latKey - A JSON key that holds the latitude value
- longKey - A JSON key that holds the longitude value
- latElement - An XML element that holds the latitude value
- longElement - An XML element that holds the longitude value
- coordinateSystem (default: wgs84) - The coordinate system to use, can be either wgs84 or raw
When the latitude and longitude are stored in attributes on an element, both must be specified along with the element that they are on.
<photo>
<title>Golden Gate Bridge</title>
<location latitude="37.819722" longitude="-122.478611"/>
</photo>
- Endpoint:
/manage/geospatial/<geo-name>
- Request type: POST
- Paramaters:
- parentElement - An XML element that contains the latAttribute and longAttribute
- latAttribute - An XML attribute that holds the latitude value
- longAttribute - A XML attribute that holds the longitude value
- coordinateSystem (default: wgs84) - The coordinate system to use, can be either wgs84 or raw
- Returns:
- On success a 200 is returned with an empty response body
- If a range, field or mapping with this name already exists, a 400 is returned
- If parameters are missing or invalid, a 400 is returned
To get a list of all the geo indexes that are configured, make a GET request to:
/manage/geospatials
Returns information about how a geo index is configured.
- Endpoint:
/manage/geospatial/<geo-name>
- Request type: GET
- Returns:
- If the geo index exists, a 200 is returned with the response body being a JSON document that describes the geo index configuration
- If the geo index does not exist, a 404 is returned
Deletes the geo index.
- Endpoint:
/manage/geospatial/<geo-name>
- Request type: DELETE
- Returns:
- If the geo index was deleted, a 200 is returned with an empty response body.
- If the geo index does not exist, a 404 is returned
Add mention that if you have pre-configured geo indexes, you can just tell Corona about them here to give them a name but there won't be any required reindexing.