Filter spatially the records in a spatial index using the Spark API
get
/spatialviewer/api/v1/spark/filterByIndex
Note that you can use the service response as data source for the Map API to display the results on map. For example:
// Default http method when fetching remote geospatial contents
OM.gv.setHttpMethod("GET");
tweetsLayer = new OM.layer.VectorLayer("Result",
{
def:{
type:OM.layer.VectorLayer.TYPE_DATAPACK,
url:'http://
:8045/spatialviewer/api/v1/spark/filterByIndex?indexPath=/user/oracle/spatialviewer/TweetsJune&queryWindow={"type":"Rectangle","srid":8307,"coordinates":[-116.71875109864604,29.0139035635888,-59.06250208499334,50.80315612882312]}',
jsonp: true},
boundingTheme: true});
// Default http method when fetching remote geospatial contents
OM.gv.setHttpMethod("GET");
tweetsLayer = new OM.layer.VectorLayer("Result",
{
def:{
type:OM.layer.VectorLayer.TYPE_DATAPACK,
url:'http://
jsonp: true},
boundingTheme: true});
Request
Query Parameters
- indexPath
-
Type:
stringRequired:trueThe index path in HDFS.
Example: /user/oracle/spatialviewer/TweetsJune - queryWindow
-
Type:
stringRequired:trueThe queryWindow in GeoJSON format.
Note that the query window can be created using the Map API toolbar standard tools like the Rectangle tool:
var queryWindow = toolbar.getBuiltInTool(OM.control.ToolBar.BUILTIN_RECTANGLE).getGeometry().transform(8307).toString();
Example: {"type":"Rectangle","srid":8307,"coordinates":[-116.71875109864604,29.0139035635888,-59.06250208499334,50.80315612882312]}
Response
Supported Media Types
- application/json
200 Response
successful request
Body
Root Schema : RecordsInfo
Type:
object- copyright
-
Type:
stringExample:Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - features
-
Type:
arrayfeatures - geodetic
-
Type:
booleantrue if the geometries are geodetic, false otherwise.Example:true - srs
-
Type:
integer(int32)SRID of the geometries.Example:8307 - type
-
Type:
stringExample:FeatureCollection
Nested Schema : Feature
Type:
object- _id
-
Type:
stringFeature id.Example:1 - geometry
-
Type:
objectGeometry - type
-
Type:
stringExample:Feature
Nested Schema : Geometry
Type:
object- coordinates
-
Type:
arraycoordinates - properties
-
Type:
objectpropertiesExtra fields of the filtered records (see 2.8.2.1 Spatial Indexing Class Structure). For example we can have extra fields named followers_count, friends_count, location and user_id - type
-
Type:
stringExample:Point
Nested Schema : properties
Type:
objectExtra fields of the filtered records (see 2.8.2.1 Spatial Indexing Class Structure). For example we can have extra fields named followers_count, friends_count, location and user_id
- followers_count
-
Type:
stringExample:70 - friends_count
-
Type:
stringExample:51 - location
-
Type:
stringExample:Canada - user_id
-
Type:
stringExample:5039703