You are here: Using REST > v2006 services > Tutorials and samples > REST v2006 sample requests

S A M P L E S

Sample REST v2006 mapping requests

The following sample URLs demonstrate how to access ArcWeb Services using REST. See the parameters tables for details on the different options you have for building your maps.

See the following sections for samples to get started using REST with ArcWeb Services:

Using map parameters

Using the required map parameters

Using best available map

Using the c parameter to pan the map

Using optional acetate parameters

Using acetate line parameter

Using acetate point parameter

Using acetate polygon parameter

Using other optional parameters

Using graticule parameter

Using legend parameter

Using north arrow parameter

Using scale bar parameter

Using north arrow and scale bar parameters

Using projection parameters

Using best map projection

Using specific map projections

Using the default projection

Using map parameters

The following samples demonstrate the required map parameters and best available map option.

Using the required map parameters

The required parameters for a REST map are center point (c), scale factor (sf), and data source (ds). You also need to send in a token (tkn or usrid) validating you as an authorized ArcWeb user. The following examples show some basic map requests.

This request contains only the required parameters: token (tkn), center point (c), scale factor (sf), and data source (ds).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200

This request returns the above map with an image width (w) of 800 pixels and a height (h) of 600 pixels.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200 &w=800&h=600

This request returns the above map with a grayscale style sheet (stl).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200&w=800&h=600&stl=gs

This request returns the above map in PNG format (fmt).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200&w=800&h=600&stl=gs&fmt=png

This request rotates the above map by an angle (a) of 45 degrees in a clockwise direction.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200&w=800&h=600&stl=gs&fmt=png&a=45

Using best available map (ds=bam)

You can request the best available map (ds=bam), and the generated map will use the most appropriate data source for your input scale and center point. The following examples show how the data source changes as you change the center point (c) and scale factor (sf) parameter values.

In this example, the generated map uses the data source ArcWeb:TA.Streets.US.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=bam&sf=116200

If you change the center point to a place in Canada (c=80.58657|45.99326), the generated map uses the data source ArcWeb:TA.Streets.NA.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-80.58657|45.99326&ds=bam&sf=116200

If you change the center point to a place in Europe (c=1.58657156871|45.9932659), the generated map uses the data source ArcWeb:TA.Streets.EU.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=1.58657|45.99326&ds=bam&sf=116200

If you change the scale to a world view (sf=110000000), the generated map uses the data source ArcWeb:AND.World.Roads.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=1.58657|45.99326&ds=bam&sf=110000000

Using the c parameter to pan the map

The following sample demonstrates how to pan a map using the c parameter. The first request gets a map. The second request pans the map.

  1. This request uses c along with other required parameters to get a map. Note that the ocs parameter is not used.
  2. EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117|34&sf=5000000&ds=ArcWeb:TA.Streets.US

    The map is returned in the default projection of 4326.

  3. This request pans the map. Panning is performed by changing the value of the c parameter in the above request.
  4. EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-120|33&sf=5000000&ds=ArcWeb:TA.Streets.US

    Note that the map is panned 3 decimal degrees to the west and 1 decimal degree to the south.

Using optional acetate parameters

The following samples demonstrate the acetate line, acetate point, and acetate polygon parameters.

Using acetate line parameter

This request overlays two polylines on a map. Notice for each polyline, three parameters are set: x|y coordinate series for line location (ln), color (lnc), and width (lnw).

EXAMPLE

http://arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=83920754&ds=ArcWeb:TA.Streets.US&c=-117|34&ln=-117|34|-95|45|-85|40|-80|45&lnc=DD00FF00&lnw=5&ln=-100|30|-85|35|-95|40&lnc=DDFF0000&lnw=9

Using acetate point parameter

This request adds three point markers with labels on your map. Notice for each point, three parameters are set: location (p), icon (pi), and label (pl).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=83920754&fmt=png&ds=ArcWeb:TA.Streets.US&c=-117|34&p=-117|34&p=-120|45&p=-100|40&pl=start&pi=airport.gif&pl=via&pi=pushpin_red.gif&pi=pushpin_blue.gif&pl=stop

Using acetate polygon parameter

This request adds two polygons on your map. Notice for each polygon, two parameters are set: x|y coordinate series for vertices location (plg) and color (plc).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=83920754&ds=ArcWeb:TA.Streets.US&c=-117|34&plg=-117|34|-120|45|-100|50&plc=330000FF&plg=-80|45|-100|50|-110|35|-90|30&plc=DD00DD00

Using other optional parameters

The following samples demonstrate the graticule, legend, north arrow, scale bar, and combined north arrow and scale bar parameters.

Using graticule parameter

This request overlays a graticule (g) on the map.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=110000000&g=5

Using legend parameter

This request displays a legend (l) on the map.

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200&l=10|5

Using north arrow parameter

This request adds a north arrow to your map. Notice that four parameters are set: center point (na), width (naw), height (nah), and type (nat).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200&na=40|60&naw=70&nah=80&nat=gr

Using scale bar parameter

This request adds a scale bar to your map. Notice that three parameters are set: location (sbx), width (sbw), and type (sbt).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200&sbx=10|10&sbw=90&sbt=2

Using north arrow and scale bar parameters

This request adds a north arrow and a scale bar to your map. Notice that four parameters are set for the north arrow: center point (na), width (naw), height (nah), and type (nat). Three parameters are set for the scale bar: location (sbx), width (sbw), and type (sbt).

EXAMPLE

http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&c=-117.58657|33.99326&ds=ArcWeb:TA.Streets.US&sf=116200&na=40|60&naw=70&nah=80&nat=bk&sbx=10|10&sbx=10|10&sbw=90&sbt=2

Using projection parameters

The following samples demonstrate best map projection, specific map projections, and the default projection for SVG format.

For each projected map, you need to make two requests. The first request returns a projected map and turns projection on using the ocs parameter. The second request works in projection mode and requires two additional parameters to pan and zoom the map: cmr and dc. The cmr value is derived from the results of the first projection request.

Projections in REST URLs are done this way so all the projection calculations are made on the server side. This ensures a swift response and makes it easy to use.

See projection parameters for valid values.

Using best map projection

The following sample uses two requests. The first request gets a map and turns projection mode on. The second request pans and zooms the map within projection mode.

  1. This request returns an automatically projected map using ocs=0, along with c and other required map parameters. See OCS types for details.
  2. EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=250000000&ds=ArcWeb:AND.Roads.World&c=-117.875871|33.93265&fmt=svg&ocs=0

    Note that the map is returned in projection 3 (Transverse Mercator). This information is returned in the desc tag (for SVG format) in the source. To view it, right-click the map, click View Source, and view the contents of the desc tag. You will need this information for the cmr string in the next request. See projection parameters for details.

  3. Once the projected map is turned on, use dc and cmr along with other required map parameters to pan the map 50 pixels to the west and 100 pixels to the south. Note that cmr can be obtained from the HTTP header or, for SVG format, right-click on the map from the projection request and click View Source. Then copy the contents of the desc tag and assign that value to the cmr string in the URL for the request to pan the map. Note that ocs in the following request is set to 0.
  4. EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf= 1000000&ds=ArcWeb:AND.Roads.World&c=-117.87587|33.93265&fmt=svg&ocs=0&cmr=-117.87587|33.93265|0.0|0.0|1000000.0|0.0|3&dc=50|100

Using specific map projections

The following sample uses two requests. The first request gets a map and turns projection mode on. The second request pans and zooms the map within projection mode.

  1. This request uses c and ocs, along with other required parameters to get a map in OCS type 6 (Bonne). See OCS types for details.
  2. EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=100000&ds=ArcWeb:AND.Roads.World&c=-117.87587|33.93265&fmt=svg&ocs=6


  3. This request uses dc and cmr along with other required map parameters to pan the map keeping the same projection. Note that ocs in the following request is set to 6.
  4. Right-click the map in the previous request and click View Source, copy the contents of the desc tag, and assign that value to the cmr string in the URL for this request.

    EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=100000&ds=ArcWeb:AND.Roads.World&c=-117.87587|33.93265&fmt=svg&ocs=6&cmr=-117.875871|33.93265|0.0|0.0|100000.0|0.0|6&dc=50|100

    Note that the map is panned 50 pixels to the west and 100 pixels to the south but the projection remains the same. To confirm, right-click the map, click View Source, and view the contents of the desc tag.

Using default projection

The following sample uses two requests. The first request gets a map and turns projection mode on. The second request pans and zooms the map within projection mode.

  1. This request uses c along with other required parameters to get a map in the default projection. Note that the ocs parameter is not used.

    EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=100000&ds=ArcWeb:AND.Roads.World&c=-117.87587|33.93265&fmt=svg

    The map is returned in the default projection of 4326.

  2. This request uses dc and cmr along with other required map parameters to pan the map. Note that ocs parameter is not used in this request. For the cmr parameter, right-click the map in the REST request in step 1, click View Source, copy the contents of the desc tag, and assign that value to the cmr string in the URL for this new request.

    EXAMPLE

    http://www.arcwebservices.com/services/v2006/restmap?actn=getMap<&tkn=ArcWeb Token OR &usrid=ArcWeb usrid>&sf=100000&ds=ArcWeb:AND.Roads.World&c=-117.87587|33.93265&fmt=svg&cmr=-117.87587|33.93265|0.0|0.0|100000.0|0.0|4326&dc=50|100

    Note that the map is panned 50 pixels to the west and 100 pixels to the south.

See also


Visit the Feedback page to give comments or suggestions about the ArcWeb Developer's Guide.

ArcWeb site | ArcWeb support | support.esri.com

Copyright © ESRI