Create a spatial index using the Hadoop API

post

/spatialviewer/api/v1/hadoop/createIndex

The index metadata directory is the directory index_metadata contained in the SpatialViewer HDFS working directory (see SpatialViewer configuration).

Request

Supported Media Types
Query Parameters
Body ()
Index details
Root Schema : HadoopIndexInfo
Type: object
Show Source
  • Path of the file or files to index in HDFS.
    Example: /user/oracle/spatialviewer/tweetsJune.json
  • The index name.
    Example: TweetsJune
  • New index path. This is the job output path.
    Example: /user/oracle/spatialviewer/TweetsJune
  • The input format class.
    Example: oracle.spatial.hadoop.vector.geojson.mapred.GeoJsonInputFormat
  • jar name with the user-defined classes like custom RecordInfoProvider or InputFormat. If the InputFormat class or the RecordInfoProvider class is not in the API, or in the hadoop API classes, then a jar with the user-defined classes must be provided. To be able to use this jar the user must add it in the /opt/oracle/oracle-spatial-graph/spatial/web-server/spatialviewer/WEB-INF/lib directory and restart the server. Optional property.
    Example: myjar.jar
  • When using the MVSuggest service, the user can define the templates (file names) used to create the index. See examples on how to use the MVSuggest (data enrichment service) in the folder /opt/oracle/oracle-spatial-graph/spatial/vector/examples. Optional property.
    Example: world_continents,world_countries,world_states_provinces
  • The class that provides the spatial information.
    Example: oracle.spatial.hadoop.vector.geojson.GeoJsonRecordInfoProvider
  • SRID of the geometries to be indexed.
    Example: 8307
  • Double value that represents the tolerance used when performing spatial operations.
    Example: 0.05
  • True if the MVSuggest (data enrichment) service must be used, false otherwise.
    Example: false
Back to Top

Response

Supported Media Types

201 Response

successful index creation
Body ()
Root Schema : CreateHadoopIndexJobResponse
Type: object
Show Source

202 Response

accepted asynchronous index creation
Body ()
Root Schema : AsyncCreateHadoopIndexJobResponse
Type: object
Show Source
Back to Top

Examples

The following example shows how to create a Hadoop index by submitting a POST request on the REST resource using cURL.

curl -v -X POST "http://localhost:8045/spatialviewer/api/v1/hadoop/createIndex" -H  "accept: application/json" -H  "content-type: application/json" -d "{  \"indexName\": \"tweetsJanuary\",  \"dataPath\": \"/user/oracle/tweets.json\",  \"indexPath\": \"/user/oracle/tweetsJanuary\",  \"srid\": 8307,  \"tolerance\": 0.05, \"inputFormatClass\": \"oracle.spatial.hadoop.vector.geojson.mapred.GeoJsonInputFormat\",  \"recordInfoProviderClass\": \"oracle.spatial.hadoop.vector.geojson.GeoJsonRecordInfoProvider\",  \"useMVSuggest\": false}" 

Example of Response Header

The following shows an example of the response header.

HTTP/1.1 201 Created Date: Wed, 15 Nov 2017 17:50:38 GMT Location: hdfs://localhost:8020/user/oracle/tweetsJanuary Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET, POST, DELETE, PUT Access-Control-Allow-Headers: Content-Type, Accept Transfer-Encoding: chunked  Content-Type: application/json

Example of Response Body

The following example shows the contents of the response body in JSON format:

{"status" : "success", "title" : "Create Index.", "o:successCode" : "SV-05002", "response" : "hdfs://localhost:8020/user/oracle/tweetsJanuary"} 
Back to Top