MapRestServiceExamples » History » Version 28

« Previous - Version 28/73 (diff) - Next » - Current version
Pere Roca Ristol, 11/04/2009 07:22 PM

Examples for URI requests to the Map REST Service

Integrate clear colourful maps into your own website or application. Choose data sources and adapt colour, symbology, extent, background textures and line types to fully customise your map.

This page give some usage examples of the Map REST Service API.

Be aware that these examples *don't conform to RFC 398*6, as the current implementation still doesn't follow the proposed syntaxis. It means that the syntaxis of these examples (and MapRest Services) may change in the coming weeks.

Map REST Service - Version 1

_ Does not conform to the latest syntax definition! _

1. Distribution Maps

Service URL:


Map Image size is specified as 400 pixels width. It means the height will be 200 pixels (just the half). Attention: you cannot specify an odd number as width/height.

A bounding box (bbox) is specified. We strongly recommend to use bbox if know it (for example if all your data is on the same zone).

We provide world country borders and all TDWG levels as background. This parameter must be specified in "l" parameter (l=earth in that example).

Current codes for background layers are:

-Country borders: earth

-TDWG level 1: tdwg1

-TDWG level 2: tdwg2

-TDWG level 3: tdwg3

-TDWG level 4: tdwg4

<code class="html">
<img src=",VAN,BAN,SRL,VIE,MOL,CHC,CRL,JAW,FIJ,SUM,MYA,MLY,NWG,MRN,AND,CHH,BOR,IND,CHS,THA,TAI,LAO,SUL,BIS,CBD,SOL,ASS&as=a:8dd3c7,,1&ms=300&bbox=-180,-90,180,90" />


We see here the "recalculate" parameter in action.

When the bbox is not specified, the service will calculate it and try to fit the image to the specified dimensions (width/height). It can cause distorted images.

Recalculate=true (this is the default if nothing is specified) tries to avoid these distortions. It means also that in some cases the final image size will change as you can see in the first image.

<code class="html">
<img src=",VAN,BOR|b:BIS,SUM&as=a:8dd3c7,,2|b:e91f16,5be166,,2_4&ms=500&label=1" />
<code class="html">
<img src=",VAN,BOR|b:BIS,SUM&as=a:8dd3c7,,2|b:e91f16,5be166,,2_4&ms=500&label=1&recalculate=false" />


You can mix different TDWG layers. In that case, TDWG level 3 and TDWG level 1.

No background layer is defined, so you simply get the specified areas.

<code class="html">
<img src="|a:SPA,ITA||tdwg1:b:2&as=a:d7add2|b:ab8dc9F&ms=300,200&label=1" />


A more complex styling. The parameters for styling an area are:

-Area fill color

-Area stroke color

-Area stroke width

-Area stroke dash style: we currently provide 1_2,1_4,2_2,2_4,5_7 and 10_5 but it can change. First parameter determine the length in pixels to draw the line, and the second, the length in pixels to blank out the line. As example, 5_7 means a very dashed line (separated 7 pixels one line from another).

We allways provide default values. So, you could even specify styles "a" and "b" as a:|b: and the image will be generated.

A style like b:0000ff~2 would mean 0000ff fill color and 2 pixels stroke width. The other parameters would be set as default.

<code class="html">
<img src="|b:MXETA||tdwg3:a:MXC,CUB|b:MXE,MXG|c:MXS,MXT&as=a:329d2a,483eef,2,2_2|b:ab8dc9F,da1029,2,5_7|c:d2e347|d:f7555d&ms=500&bbox=-115,6.78,-75.19,29.8&recalculate=false" />


A legend can be appended to your map in different positions.

Specify "title" parameter, associating to each style the desired legend. Also legend=1 and "mlp" (map legend position)

It is important to assign, for each style, a title, otherwise cause error.

The map legend position can be:

-1: outside of the map, up left

-2: outside of the map, up

-3:outside of the map, up right

-4: outside of the map, below left

-5: inside of the map, below right

-6: inside of the map, below left

-7: inside of the map, up right

<code class="html">
<img src="|b:native|c:rare|d:unknown&ad=tdwg4:c:MXEDU|b:MXETA||tdwg3:a:MXC,CUB|b:MXE,MXG|c:MXS,MXT&as=a:329d2a,483eef,2,2_2|b:ab8dc9F,da1029,2,5_7|c:d2e347|d:f7555d&ms=500&bbox=-115,6.78,-75.19,29.8&recalculate=false" />

A separate service generating legend has been set up, so you can put the legend wherever you want on your html.

<code class="html">
<img src="|b:native|c:rare|d:unknown&as=a:329d2a,483eef,2,2_2|b:ab8dc9F,da1029,2,5_7|c:d2e347|d:f7555d&ms=60,50"/>

earth in the l attribute.


<code class="html">
<img src=",2&as=b:ab8dc9F&ms=300,150&recalculate=true&label=1&bbox=-180,-90,180,90" />
  • TDWG 2 Layer Countries *

Using tdwg2 in the l attribute.


<code class="html">
<img src=",2&as=b:ab8dc9F&ms=300,150&recalculate=true&label=1&bbox=-180,-90,180,90" />

Occurrence Maps

Service URL:


<code class="html">
<img src=",43.30086%7C41.7093,43.50803%7C44.28416,7.39742%7C44.20383,7.43884&os=1:c/8B0000/10/Pieris%20rapae%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C2:s/64cb48/0/%20|3:s/64cb48/0/%20&ms=400,350&bbox=6.6,43.8,7.75,44.5&recalculate=true" />


<code class="html">
<img src=",-0.822%7C38.328,-0.542%7C38.062,-0.893%7C%7C2:38.062,-0.893%7C38.012,-1.883%7C%7C3:40.78,-4.009%7C43.461,-5.412%7C38.062,-0.893&os=1:c/f78755/10/Onthophagus%20semipunctatus%7C2:s/64cb48/35/Euoniticellus%20pallipes%7C3:sq/cbde4f/20/Onthophagus%20joannae&ms=700x350&l=v:e_provinces&q_layer=e_provinces&recalculate=true" />

Map REST Service - next Version

Add picture from clipboard (Maximum size: 40 MB)