Technical documentation of Geoportal API

  • FR
  • UK

Index / Documentation / Technical documentation

Coordinate reference systems

Re-projecting coordinates

It is worth noting that displayed data are in IGNF:GEOPORTALxxx projection (Equidistant cylindrical, xxx is the territory code) and displayed control data (such as mouse coordinates) are in the underlying geographic reference system of the projection.

To get access to the map's projection, use the following code snippet :

var map_projection= myMap.getMap().getProjection();

To get access to the controls' projection, use the following code snippet :

var ctrl_projection= myMap.getMap().getDisplayProjection();

Most OpenLayers widgets supports re-projection through the use of the transform(OpenLayers.Projection ini,OpenLayers.Projection fin) method. Have a look at the OpenLayers API for more information.

Thus for re-projecting GPS geographical coordinates into map coordinates, one could use the following code snippet :

var p= new OpenLayers.LonLat(longitude, latitude);
p.transform(OpenLayers.Projection.CRS84, myMap.getMap().getProjection());

Accessing unsupported CRS

The API only supports in its extended release more than 200 CRSs.

If one wants to use an unsupported CRS, it is necessary to add a proxy as the API uses Ajax to get access to the Spatial Reference web site. For more information about proxy setting, see Layer access.

Eventually, one can directly add the CRS definition in the web page as follows :

<!DOCTYPE html>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <div id="viewerDiv" style="width:800px;height:600px;"></div>
    <script type="text/javascript"><!--//--><![CDATA[//><!--
        window.onload= function() {
            Geoportal.load("viewerDiv", {
                null, {
                    onBeforeView: function() {
                        //add new projection
'+proj=utm +zone=30 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +title=UTM North Zone 30 - France';
    <script type="text/javascript" src="" charset="utf-8">