How to: |
The GIS_DISTANCE function uses a GIS service to calculate the distance between two geometry points.
GIS_DISTANCE(geo_point1,geo_point2)
where:
Fixed length alphanumeric, large enough to hold the JSON describing the point (for example, A200).
Are the geometry points for which you want to calculate the distance.
Note: You can generate a geometry point using the GIS_POINT function.
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_DISTANCE to calculate the distance between them.
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); Distance/P10.2 = GIS_DISTANCE(ENDPOINT, STARTPOINT); END TABLE FILE esri/esri-citibike PRINT END_STATION_NAME AS End Distance BY START_STATION_NAME AS Start ON TABLE SET PAGE NOLEAD END
The output is shown in the following image.