Internet Maps and Routing with ESRI products

By Eugene Kostin

Software Technologies presents the article comparing two leading Internet mapping server products: ArcIMS Route Server 1.0 and RouteMAP IMS 2.0.These products are a result of close collaboration by Software Technologies and ESRI.

Introduction

This article compares two ESRI Internet-based GIS server products: RouteMAP IMS 2.0 and ArcIMS Route Server 1.0 extension.These products have different Application Programming Interfaces (APIs) though they provide similar functionality.They include the rendering of map images, geocoding locations, and driving directions.These software platforms allow the creation of powerful LBS solutions, where the most probable scenario is geocoding a location, generating driving directions, and optionally getting a map image.

The main difference between RouteMAP IMS and ArcIMS Route Server APIs is that RouteMAP IMS provides a COM API, while ArcIMS Route Server provides an XML API. All of the following examples contain JavaScript code to demonstrate RouteMAP IMS API access.Any XML parser can be used to compose and parse XML documents to communicate with ArcIMS Route Server.

Server connection

With RouteMAP IMS, it is necessary to create a Map object, which encapsulates the whole server functionality.Here is an example:

var MapTemplate Server.CreateObject("RMImsApi.MapFactory");
var 
Map MapTemplate.openMap("demo.softech.ru""DEMOGROUP""author""map");

The above code indicates that the server URL is "demo.softech.ru", users group is "DEMOGROUP", user name is "author", and map ID is "map".These parameter settings depend on server configuration.

ArcIMS Route Server does not require any preliminary initialization of the client, and requests can be sent using HTTP POST method.

Geocoding

The key result of any Location Based Solution is location.Geocoding is the process, which allows obtaining location by specifying a set of user-friendly parameters, like street address or postal code.

Functional comparison:

Functionality

RouteMAP IMS 2.0

ArcIMS Route Server 1.0

Street address geocoding

+

+

Streets intersection geocoding

+

+

Postal code geocoding

+

+

City name geocoding

+

-

County name geocoding

+

-

Area code geocoding

+

-

Latitude/Longitude geocoding

+

+

Reverse geocoding an address

-

+

Reverse geocoding an address range

-

+

RouteMAP IMS API allows geocoding an address with one function call:

var ResultLocation Map.findAddress("380 New York st""Redlands""CA""92373");

ArcIMS Route Server requires the following XML request to geocode a location.
To geocode a street address:

<?xml version="1.0" encoding="UTF-8" ?>
<ARCXML version="1.1"
  <
REQUEST
    <
GET_GEOCODE maxcandidates="10" minscore="60"
      <
LAYER id="18" />
        <
ADDRESS
          <
GCTAG id="Street Address" value="380 new york St" />
          <
GCTAG id="5-digit ZIP code" value="92373" />
          <
GCTAG id="City" value="redlands" />
          <
GCTAG id="State" value="ca" />
        </
ADDRESS>
     </
GET_GEOCODE
  </
REQUEST
</
ARCXML>

The above request implies, that there is a streets layer and its layerID is 18.This information depends on map service configuration.Streets layer ID can be either hard-coded for a specific service, or obtained through GET_SERVICE_INFO request.

Returned XML response would contain coordinates of found location:

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
  <
RESPONSE>
    <
GEOCODE>
      <
FEATURE featureid="1">
        <
FIELD type="4" name="SCORE" size="5" precision="0">
          <
FIELDVALUE valuestring="100" />
        </
FIELD>
        <
FIELD type="12" name="ADDRESSFOUND" size="5" precision="0">
          <
FIELDVALUE valuestring="89509" />
        </
FIELD>
        <
FIELD type="-98" name="SHAPEFIELD">
          <
FIELDVALUE>
            <
POINT x="-119.90546116" y="39.45247355" />
          </
FIELDVALUE>
        </
FIELD>
      </
FEATURE>
      <
GCCOUNT count="1" />
    </
GEOCODE>
  </
RESPONSE>
</
ARCXML>

Routing

Functional comparison:

Functionality

RouteMAP IMS 2.0

ArcIMS Route Server 1.0

Door-to-door routing

+

+

Multipoint routing

+

+

Detailed turn-by-turn driving directions

+

+

Stops order optimization

+

-

Shortest distance routing

+

+

Quickest time routing

+

+

Highway preference/avoidance setting

+

+

RouteMAP IMS provides a set of COM objects to set up routing parameters and obtain results.

First, it is necessary to create a location list:

var locationsList Server.CreateObject"rmimsapi.LocationList" );

Then, having start and finish location variable obtained from geocoding, populate the list:

locationsList.addLocationstart );
locationsList.addLocationfinish );

Now, get the RouteFinder object and set stops list:

var rFinder Map.getRouteFinder();
rFinder.setStopslocationsList );

Set routing parameters:

rFinder.setHighwayPreference50 ); // neutral highway preference
rFinder.setWeight); // find quickest route
rFinder.setOptimizefalse ); // turn off stops order optimization

Finally, calculate the route:

var nRouteID rFinder.findRoute();

Returned RouteID is the key, which is necessary to get routing results.
Also, found route is cached on the server, so getting route results by key won't lead to recalculating the route.

// Get table of route segments
nRouteID unescapenRouteID );
routePlan Map.getRoutePlannRouteID );

Here is an example of how to access RoutePlan object:

Response.Write"<table border=1 align=center>" );
for ( var 
seg 0;  seg routePlan.getSegmentsCount(); seg++ )
{
Response.Write"<tr><td><center>" routePlan.getTurnTextseg ) + "<br>" routePlan.getTimeLengthTextseg ) + "</center></td></tr>" );
}
Response.Write"</table>" );

Above code would generate a table like this one:

Go North on Richardson DR
Drive 0.6 mile(s) ~ 1 minute(s)

Bear right on Municipal DR
Drive 0.2 mile(s) ~ < 1 minute

Turn left on N Collins BLVD
Drive < 0.1 mile(s) ~ < 1 minute

Turn right on W Campbell RD
Drive 0.4 mile(s) ~ < 1 minute

ArcIMS Route Server requires the following kind of XML request to be sent in order to get driving directions.

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
  <
REQUEST>
    <
GET_ROUTE name="myroute">
      <
STOPSLIST>
        <
ROUTE_STOP id="0" desc="75080">
          <
POINT x="-96.743072" y="32.971216"/>
        </
ROUTE_STOP>
        <
ROUTE_STOP id="1" desc="75081">
          <
POINT x="-96.710713" y="32.948611"/>
        </
ROUTE_STOP>
      </
STOPSLIST>
      <
ROUTEFILTER>
        <
ENVELOPE minx="-180.0063613231552" miny="11.358778625954183" maxx="-64.99363867684477" maxy="78.64122137404581"/>
      </
ROUTEFILTER>
      <
ROUTE_PROPERTIES>
        <
ROUTETYPE>quickest</ROUTETYPE>
        <
HWYPREF>50</HWYPREF>
        <
PRECISION>0.1463266191428886</PRECISION>
      </
ROUTE_PROPERTIES>
    </
GET_ROUTE>
  </
REQUEST>
</
ARCXML>

This XML request contains routing stops descriptions with coordinates, route type (quickest or shortest), highway preference value, and route rendering options.ROUTEFILTER and PRECISION serve to specify result route shape clipping and generalization options to minimize XML response size.

The following is the example of routing result, which is returned in response XML:

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
  <
RESPONSE>
    <
ROUTE name="myroute">
      <
ENVELOPE minx="-96.743891" miny="32.948309" maxx="-96.710800" maxy="32.971600"/>
      <
PARTS>
        <
PART fromstop="0" tostop="1" >
          <
SEGMENT distance="0.022168" time="0.053202">
            <
ENVELOPE minx="-96.743072" miny="32.971600" maxx="-96.742673" maxy="32.971600"/>
            <
DESCRIPTION>Depart 75080</DESCRIPTION>
            <
DESCRIPTION>Go East on Kindred Ln</DESCRIPTION>
            <
DESCRIPTION>Drive &lt0.1 mile(s) ~ &lt1 minute</DESCRIPTION>
            <
POLYLINE>
              <
PATH>
                <
COORDS>-96.743072 32.971600;-96.742673 32.971600</COORDS>
              </
PATH>
            </
POLYLINE>
          </
SEGMENT>
          ...
          <
SEGMENT distance="0.119234" time="0.286162">
            <
ENVELOPE minx="-96.711182" miny="32.948489" maxx="-96.710800" maxy="32.950200"/>
            <
DESCRIPTION>Turn right on Ocean Dr</DESCRIPTION>
            <
DESCRIPTION>Drive 0.1 mile(s) ~ &lt1 minute</DESCRIPTION>
            <
DESCRIPTION>Arrive 75081</DESCRIPTION>
            <
POLYLINE>
              <
PATH>
                <
COORDS>-96.711182 32.950200;-96.710800 32.948489</COORDS>
              </
PATH>
            </
POLYLINE>
          </
SEGMENT>
        </
PART>
      </
PARTS>
      <
TOTALS distance="3.559411" time="6.366667">
        <
DESCRIPTION>Driving distance3.6 mile(s)</DESCRIPTION>
        <
DESCRIPTION>Driving time6 minute(s)</DESCRIPTION>
      </
TOTALS>
    </
ROUTE>
  </
RESPONSE>
</
ARCXML>

This response contains textual driving directions along with route shape coordinates and total time and distance information.

Image generation

Both servers provide the way to get map image URL.This URL may be used by clients to retrieve map image ready to be inserted to a web page or wherever it is appropriate.

RouteMAP IMS API provides the following way to generate a map image:

Map.setExtentCoordnTopnLeftnBottomnRight );
var 
MapImgUrl Map.getMapImageUrl();

Generated map image will have route displayed once RouteFinder.findRoute() function was called and route was found.The following is the example of map image that is generated by RouteMAP IMS with route depicted.

ArcIMS Route Server requires the following XML request to be sent to generate a map image:

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
  <
REQUEST>
    <
GET_IMAGE>
      <
PROPERTIES>
        <
ENVELOPE minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0" />
        <
IMAGESIZE width="800" height="600" />
      </
PROPERTIES>
    </
GET_IMAGE>
  </
REQUEST>
</
ARCXML>

And the following is the response:

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
  <
RESPONSE>
    <
IMAGE>
      <
ENVELOPE minx="-180" miny="-135" maxx="180" maxy="135" />
      <
OUTPUT file="c:arcimsoutputworld_MYMACHINE3633699.jpg"
      
url="http://demo.softech.ru/output/world_MYMACHINE3633699.jpg" 
      
/>
    </
IMAGE>
  </
RESPONSE>
</
ARCXML>

However, if the route needs to be drawn on the map, it is necessary to add result route shape as acetate layer in GET_IMAGE request, e.g.:

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
  <
REQUEST>
    <
GET_IMAGE>
      <
PROPERTIES>
        <
ENVELOPE minx="-96.7275697" miny="32.9655408" maxx="-96.7275013"
        
maxy="32.9656272" />
        <
IMAGESIZE width<


Published Wednesday, February 27th, 2002

Written by Eugene Kostin



If you liked this article subscribe to our newsletter...stay informed on the latest geospatial technology

© 2016 Directions Media. All Rights Reserved.