English

How To: Process data from a nonspatial table in ArcGIS GeoEvent Server

Summary

By design, GeoEvent Server's interface to enterprise databases is through published map services, feature services, or both. GeoEvent Server provides an input connector named "Poll an ArcGIS Server for Features" for polling map and feature services for records that include geometry.

Often, users want to incorporate data from a non-spatial table with X and Y coordinate values into a GeoEvent Server workflow and require GeoEvent Server to use the coordinate values in the table's rows to construct a Point Geometry. "Poll an ArcGIS Server for Features" input does not offer this capability, as it assumes that feature records include geometry.

One approach to this challenge is treating the map or feature service like a web service and polling ArcGIS Server as if it is an external server. To retrieve records from the non-spatial table as JavaScript Object Notation (JSON), a different type of GeoEvent Server input connector named "Poll an External Website for JSON" can be configured. This input includes the ability to construct geometry from fields and can be pointed to the non-spatial table's layer exposed by the map or feature service.

Procedure

Publish a map service that includes a nonspatial table as a layer

  1. In ArcMap, prepare a new map document with two layers:
    • An empty feature class
    • Any non-spatial table with X and Y coordinate values
    Note:
    If data in the non-spatial table is to be updated, make sure that the data sources are registered. This ensures the latest data values are returned from the map service when GeoEvent Server polls the service.
  2. Once published, navigate to the REST page for the service.
  3. Click the link provided in the Tables section.

    User-added image
     
  4. Scroll to the bottom of the page and select Query.

    User-added image
  5. The Query parameters should be as follows. Refer to the image below.
    • Where: 1=1
    • Out Fields: *
    • Return Geometry: False
    • Format: JSON

      User-added image
       
  6. Click Query (GET). The page redirects to the results of the query, formatted in pretty json (PJSON).

    Query URL:
     
    http://<server_name>/arcgis/rest/services/NS_test/MapServer/1/query?where=1%3D1&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=false&returnTrueCurves=false&returnIdsOnly=false&returnCountOnly=false&returnZ=false&returnM=false&returnDistinctValues=false&returnExtentsOnly=false&f=json

    Query Result (JSON):
    {"displayFieldName":"Name","fieldAliases":
    {"Name":"Name","X":"X","Y":"Y","ID":"ID"},"fields":
    [{"name":"Name","type":"esriFieldTypeString","alias":"Name","length":10},
    {"name":"X","type":"esriFieldTypeDouble","alias":"X"},
    {"name":"Y","type":"esriFieldTypeDouble","alias":"Y"},
    {"name":"ID","type":"esriFieldTypeDouble","alias":"ID"}],"features":[{"attributes":
    {"Name":"Daniel    ","X":500000,"Y":3762155,"ID":1}},{"attributes":{"Name":"Tommy     
    ","X":500000,"Y":5983521,"ID":2}},{"attributes":{"Name":"Rashan   
     ","X":500000,"Y":8212038,"ID":3}}]}
Prepare the Query URL for incorporation into a GeoEvent input
  1. Remove the from the end of the URL so that it displays f=json. The query executed by GeoEvent Server must be written in raw JSON, and not PJSON or formatted JSON.
  2. (Optional) Simplify the Query URL by removing query parameters that do not provide any values.
    1. Copy and paste the Query URL into a text editor.
    2. Search for instances where a query parameter's value is empty or unspecified.
    3. Delete these query parameters from the Query URL.
    4. Some of the expected empty/unspecified query parameters are highlighted below.

      Query:
      User-added image

      Simplified Query:
      User-added image
  3. In GeoEvent Manager, create a new Poll an External Website for JSON input connector.
  4. Copy and paste the Query URL into the input's URL parameter.
  5. The parameters that must be modified are as follows. The rest of the parameters can be modified as desired. Refer to the image below.
    • Create GeoEvent Definition: Yes
    • GeoEvent Definition Name (New): <NAME>
    • Construct Geometry From Fields: Yes
    • JSON Object Name: features
    • X Geometry Field: attributes.<Field with X coordinates>
    • Y Geometry Fields: attributes.<Field with Y coordinates>

      User-added image
    Note:
    The definition created is a hierarchical definition, with "attributes" as the grouped field with field names as sub-elements under this group.
  6. Save the input.
  7. The count on the input connector goes up from the monitor page, showing the number of existing records in the table.

    User-added image

Related Information