How to: |
The GIS_DRIVE_ROUTE function uses a GIS service to calculate the driving route between two geometry points.
Note: This function uses GIS services and requires an Esri ArcGIS adapter connection with named credentials.
GIS_DRIVE_ROUTE(geo_start_point,geo_end_point)
where:
Fixed length alphanumeric, large enough to hold the JSON describing the point (for example, A200).
Is the starting point for which you want to calculate the drive route.
Note: You can generate a geometry point using the GIS_POINT function.
Fixed length alphanumeric, large enough to hold the JSON describing the point (for example, A200).
Is the ending point for which you want to calculate the drive route.
Note: You can generate a geometry point using the GIS_POINT function.
The format of the field to which the drive route will be returned is TX.
The following uses a citibike .csv file that contains station names, latitudes and longitudes, and trip start times and end times. It uses the GIS_POINT function to define geometry points for start stations and end stations. It then uses GIS_DRIVE_ROUTE to calculate the route to get from the end point to the start point.
DEFINE FILE esri/esri-citibike STARTPOINT/A200 = GIS_POINT('4326', START_STATION_LONGITUDE, START_STATION_LATITUDE); ENDPOINT/A200 = GIS_POINT('4326', END_STATION_LONGITUDE, END_STATION_LATITUDE); Route/TX140 (GEOGRAPHIC_ROLE=GEOMETRY_LINE) = GIS_DRIVE_ROUTE(ENDPOINT, STARTPOINT); END TABLE FILE esri/esri-citibike PRINT START_STATION_NAME AS Start END_STATION_NAME AS End Route WHERE START_STATION_ID EQ 147 ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF,SIZE-11,$ ENDSTYLE END
The output is shown in the following image.
The following request uses GIS_DRIVE_ROUTE to generate a driving route between a station start point and end point and charts the route on an Esri map.
DEFINE FILE esri-citibike STARTPOINT/A200 = GIS_POINT('4326', START_STATION_LONGITUDE, START_STATION_LATITUDE); ENDPOINT/A200 = GIS_POINT('4326', END_STATION_LONGITUDE, END_STATION_LATITUDE); Route/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_LINE) = GIS_DRIVE_ROUTE(ENDPOINT, STARTPOINT); END
GRAPH FILE ESRI-CITIBIKE PRINT START_STATION_NAME END_STATION_NAME WHERE START_STATION_ID EQ 147 ON TABLE PCHOLD FORMAT JSCHART ON TABLE SET LOOKGRAPH CHOROPLETH ON TABLE SET EMBEDHEADING ON ON TABLE SET AUTOFIT ON ON TABLE SET STYLE * TYPE=REPORT, TITLETEXT='Map', PAGESIZE=E, CHART-LOOK=com.esri.map, $ TYPE=DATA, COLUMN=N1, /*START_STATION_NAME*/ BUCKET=tooltip, $ TYPE=DATA, COLUMN=N2, /*END_STATION_NAME*/
*GRAPH_JS_FINAL "legend": {"visible": true}, "extensions" : { "com.esri.map" : { "scalebar" : { "scalebarUnit": "dual", "attachTo" : "bottom-left" }, "baseMapInfo": { "drawBasemapControl" : false, "showArcGISBasemaps" : false, "customBaseMaps" : [ {"ibiBaseLayer" : "dark-gray"} ] }, "overlayLayers": [{ "ibiDataLayer": {"map-geometry" : {"map_by_field" : "Route"}}, "title" : "Chart"}] }, "introAnimation": "{\"enabled\":false}" } *END ENDSTYLE HEADING "Chart Drive Route" END
The output is shown in the following image.