IDEC Web Services



IDEC has developed a geoservei with 6 methodes:

1- To obtain the XY coordinates with UTM 31N, the name and region of a toponym of 1:50.000 toponymy base of the Institut Cartogrāfic de Catalunya.
2- To obtain the XY coordinates with latitude-longitude, the name and region of a toponym of 1:50.000 toponymy base of the Institut Cartogrāfic de Catalunya.
3- From its height and width, a coordinate box and a squaring method the image pixels are squared. This geoprocess has been conceived for all webMapping application based on specification WMS of the OGC.
4- Convert X Y screen píxels to X Y coordinates.
5- Convert X Y coordinates to X Y screen píxels.
6- Return name, place,coordinate XY and distance in straight line to the especified facilities.

All geoprocess have in common that expect to receive the entry parameter "key" that IDEC will give free of charge to all users once they had been registered by e-mail

-Which is the utility of squaring pixels?

According to OpenGis WMS 1.1.1 (pag.36) specification, in a WMS request, the values of WIDTH and HEIGHT specify the number of pixels used between values of X and Y maximum and minimum that can be found in the BBOX parameter, that's to say, the pixel must be squared because an "aspect ratio" has to exist between the image dimension and the coordinates box.

In case that this "aspect ratio" doesn't exist, the image will not have the pixel squared and will not appear correctly.

Some of the map servers that have implemented WMS have not considered this aspect and others serve a well formatted image, although this "aspect ratio" doesn't exist.

To square the pixel permits:

- Users may view WMS layers together, even though WMS does not take into account the "aspect ratio".

- To visualize layers together that come from different WMS servers wich have different systems of reference.

IDEC Web Services:

Repositories with software and source code:

Name URI WSLD Methods
IDEC_GeoServeis http://delta.icc.es
/webservices/services
/IDEC_GeoServeisPort
http://delta.icc.es
/webservices/services
/IDEC_GeoServeisPort?wsdl
getCoordenadesUTM getCoordenadesLatLon getQuadrarPixel getPixelsToCoord getCoordToPixels getProximitatEquipaments


Methods description:

Method Description Input Observations Output
getCoordenadesUTM When you write a toponym immediately it retorns information about the UTM coordinates, its name and the region where it is situated. xsd:string TOPONIM
SOAP request example
- xsd:string NOM, xsd:string COMARCA, xsd:double X, xsd:double Y
SOAP request example
15 answers maxim
getCoordenadesLatLon When you write a toponym immediately it retorns information sbout the Lat/Lon coordinates, its name and the region where it is situated. xsd:string TOPONIM
SOAP request example
- xsd:string NOM, xsd:string COMARCA, xsd:double X, xsd:double Y
SOAP request example
15 answers maxim
getQuadrarPixel There is a function that retorns the values to square pixels starting from a bounding box, height (px) and width of the map. xsd:string key,xsd:double Xmin ,xsd:double Ymin, xsd:double Xmax, xsd:double Ymax, xsd:integer Width, xsd:integer Height, xsd:string Quadratura'
SOAP request example
Values of Quadratura : QXmin , QYmin, QXmax, QYmax, QWidth, QHeight xsd:double Xmin ,xsd:double Ymin, xsd:double Xmax, xsd:double Ymax, xsd:integer Width, xsd:integer Height
SOAP request example
15 answers maxim.
getPixelsToCoord Convert X Y screen pixels to X Y coordinates. xsd:String CLAU,xsd:int XPIXEL, xsd:int YPIXEL, xsd:int WIDTH, xsd:int HEIGHT, xsd:double XMIN,xsd:double YMIN, xsd:double XMAX, xsd:double YMAX - xsd:double X ,xsd:double Y,
getCoordToPixels Convert X Y coordinates to X Y screen pixels. xsd:String CLAU,xsd:double XCOORD, xsd:double YCOORD, xsd:int WIDTH, xsd:int HEIGHT, xsd:double XMIN,xsd:double YMIN, xsd:double XMAX, xsd:double YMAX - xsd:int X ,xsd:int Y,
getProximitatEquipaments Return name, place,coordinate XY and distance in straight line to the especified facilities. xsd:String CLAU, xsd:double Y, xsd:double Y, xsd:double DISTANCIA,xsd:String TIPUS Valeus of DISTANCIA: meters.
Values of TIPUS : TOTS, Ajuntament, Albergs, Biblioteca, Centres CAP, Centres i delegacions , Ensenyament, Sanitat, Hospitals Publics, Policia, Poligon Industrial, Punts omnia, Punt AOC, Telecentres.
xsd:String NOM ,xsd:String MUNICIPI, xsd:double DISTANCIA, xsd:String TIPUS, xsd:double X, xsd:double Y
25 facilities maximum.


Practical examples

As a demonstration, IDEC has created two web applications that Web Services use.

Name Example 1
Description Show the results obtained in a list, capture the coordinates of the toponym in order to localize it on a map later.
Methods used getCoordenadesUTM(key,toponym)
getCoordenadesLatLon(key,toponym)


Name Example 2
Description It forwards the squared píxel values to a WMS request, to visualize them correctly on the map.
Methods used getQuadraPixel(key,Xmin,Ymin,Xmax,Ymax,Width,Height,Quadrar)


Name Example 3
Description Thin client.
Methods used All


Implementation examples

To make easier the use of Web Services, we have incorporated some code examples to create a WSC (Web Services Client).
Nowadays, it is possible to find examples with PHP using the NuSOAP free library (link to NuSOAP) and with JSP, using the Axis Apache classes.
IDEC will publish other code examples with different languages and platforms.

PHP (Hypertext PreProcessor)

It is necessary to install NuSOAP.

  • Example getCoordenadesUTM()
  • /*
    WebService: IDEC http://www.geoportal-idec.cat
    Method: getCoordenadesUTM
    Require: NuSOAP http://sourceforge.net/projects/nusoap/

    */
    function matriu_to_texte($array){
    $llarg_texte = "";

    foreach($array as $valor=>$val){
    if(is_array($val)){
    $llarg_texte .= "[$valor = {". matriu_to_texte($val)."}] , ";
    }
    else{
    $llarg_texte .= "[$valor=$val] , ";
    }
    }

    return substr($llarg_texte, 0, strlen($llarg_texte)-3);
    }require('nusoap.php');

    $metode="getCoordenadesUTM";
    $toponim="Girona";
    //IDEC key
    $key="XXXXXXXXX";

    $wsc_Parametres = array("key" =>(string)$key,"toponim" =>(string)$toponim);
    $wsc_IDEC = new soapclient('http://delta.icc.es/webservices/services/IDEC_Web ServicesPort?wsdl','wsdl');

    $Resultat = $wsc_IDEC->call($metode, $wsc_Parametres);

    if (!$wsc_IDEC->getError()) {

    echo(matriu_to_texte($Resultat));

    }else{
    echo($wsc_IDEC->getError());
    }


  • Example getCoordenadesLatLon()
  • /*
    WebService: IDEC http://www.geoportal-idec.cat
    Method: getCoordenadesLatLon
    Require: NuSOAP http://sourceforge.net/projects/nusoap/

    */
    function matriu_to_texte($array){
    $llarg_texte = "";

    foreach($array as $valor=>$val){
    if(is_array($val)){
    $llarg_texte .= "[$valor = {". matriu_to_texte($val)."}] , ";
    }
    else{
    $llarg_texte .= "[$valor=$val] , ";
    }
    }

    return substr($llarg_texte, 0, strlen($llarg_texte)-3);
    }

    require('nusoap.php');


    $metode="getCoordenadesLatLon";
    $toponim="Girona";
    //IDEC key
    $key="XXXXXXXXX";

    $wsc_Parametres = array("key" =>(string)$key,"toponim" =>(string)$toponim);
    $wsc_IDEC = new soapclient('http://delta.icc.es/webservices/services/IDEC_Web ServicesPort?wsdl','wsdl');

    $Resultat = $wsc_IDEC->call($metode, $wsc_Parametres);

    if (!$wsc_IDEC->getError()) {

    echo(matriu_to_texte($Resultat));
    }else{
    echo($wsc_IDEC->getError());
    }


  • Example getQuadrarPixel()
  • /*
    WebService: IDEC http://www.geoportal-idec.cat
    Method: getQuadrarPixel
    Require: NuSOAP http://sourceforge.net/projects/nusoap/
    */


    function matriu_to_texte($array){
    $llarg_texte = "";


    foreach($array as $valor=>$val){
    if(is_array($val)){
    $llarg_texte .= "[$valor = {". matriu_to_texte($val)."}] , ";
    }
    else{
    $llarg_texte .= "[$valor=$val] , ";
    }
    }

    return substr($llarg_texte, 0, strlen($llarg_texte)-3);
    }

    require('nusoap.php');

    $metode="getQuadrarPixel";

    //IDEC key
    $key="XXXXXXXX";

    $Xmin=498079.12;
    $Ymin=4623356.5;
    $Xmax=504552.28;
    $Ymax=4627937;
    $Width=300;
    $Height=300;

    /*Quadratura values
    QXmin
    QYmin
    QXmax
    QYmax
    QWidth
    QHeight
    */
    $Quadratura="QXmin";

    $wsc_Parametres = array('key' =>(string)$key,'Xmin'=>(double)$Xmin,'Ymin'=>(double)$Ymin,'Xmax'=>(double)$Xmax,'Ymax'=>(double)$Ymax,'Width'=>(integer)$Width,'Height'=>(integer)$Height,'Quadratura'=>(string)$Quadratura);

    $wsc_IDEC = new soapclient('http://delta.icc.es/webservices/services/IDEC_Web ServicesPort?wsdl','wsdl');

    $Resultat = $wsc_IDEC->call($metode, $wsc_Parametres);

    if (!$wsc_IDEC->getError()) {

    echo(matriu_to_texte($Resultat));

    }else{

    echo($wsc_IDEC->getError());
    }


  • Downloads PHP examples

JSP (Java Server Pages)

It demands Axis Apache libraries.

  • Example getCoordenadesUTM()
  • <%@page contentType="text/html"%>
    <%!

    /*
    This is a client of the IDEC Web Services
    http://www.geoportal-idec.cat

    It uses the Apache AXIS web services stack.
    http://ws.apache.org/axis/

    To build the client-side classes used by this JSP, do this:

    1-Install Apache AXIS
    2-produces the proxy source code

    java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java --package idecwebservices http://delta.icc.es/webservices/services/IDEC_GeoServeisPort?wsdl

    3-compiles it and places it into the CLASSES dir

    javac -classpath %AXISCLASSPATH% -g idecwebservices/*.java
    **********************************************/
    private String wsc_IDEC(String toponim) {
    int i=0;
    String resultat= "";
    String getError= "";

    //Idec Key
    String key="XXXXXXXXX";

    try {
    idecwebservices.IDEC_Web ServicesLocator rutaService = new idecwebservices.IDEC_Web ServicesLocator();
    idecwebservices.IDEC_Web ServicesPortType serviceIDEC= rutaService.getIDEC_Web ServicesPort();
    idecwebservices.ToponimsData r[] ;

    r=serviceIDEC.getCoordenadesUTM(key,toponim);

    for ( i=0; i resultat+=r[i].getNOM()+"<br>";
    resultat+=r[i].getCOMARCA()+"<br>";
    resultat+=r[i].getX()+"<br>";
    resultat+=r[i].getY()+"<br>";

    }
    }
    catch(Exception e1){
    getError= "<font color=red>ERROR: <xm" + "p>" + e1 + "</x" + "mp></font>\n";
    }

    return resultat + getError;

    }

    %>

    <%
    String result= wsc_IDEC("Girona");
    out.print(result);
    %>


  • Example getCoordenadesLatLon()
  • <%@page contentType="text/html"%> <%!

    /*
    This is a client of the IDEC Web Services
    http://www.geoportal-idec.cat

    It uses the Apache AXIS web services stack.
    http://ws.apache.org/axis/

    To build the client-side classes used by this JSP, do this:

    1-Install Apache AXIS
    2-produces the proxy source code

    java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java --package idecwebservices http://delta.icc.es/webservices/services/IDEC_GeoServeisPort?wsdl

    3-compiles it and places it into the CLASSES dir

    javac -classpath %AXISCLASSPATH% -g idecwebservices/*.java
    **********************************************/
    private String wsc_IDEC(String toponim) {
    int i=0;
    String resultat= "";
    String getError= "";

    //Idec Key
    String key="XXXXXXXXX";

    try {
    idecwebservices.IDEC_Web ServicesLocator rutaService = new idecwebservices.IDEC_Web ServicesLocator();
    idecwebservices.IDEC_Web ServicesPortType serviceIDEC= rutaService.getIDEC_Web ServicesPort();
    idecwebservices.ToponimsData r[] ;

    r=serviceIDEC.getCoordenadesLatLon(key,toponim);

    for ( i=0; i<r.length; i++) {
    resultat+=r[i].getNOM()+"<br>";
    resultat+=r[i].getCOMARCA()+"<br>";
    resultat+=r[i].getX()+"<br>";
    resultat+=r[i].getY()+"<br>";

    }

    }
    catch(Exception e1){
    getError= "<font color=red>ERROR: <xm" + "p>" + e1 + "</x" + "mp></font>\n";
    }
    return resultat + getError;

    }

    %>

    <%
    String result= wsc_IDEC("Girona");
    out.print(result);
    %>


  • Example getQuadrarPixel()
  • <%@page contentType="text/html"%>
    <%!

    /*
    This is a client of the IDEC Web Services
    http://www.geoportal-idec.cat

    It uses the Apache AXIS web services stack.
    http://ws.apache.org/axis/

    To build the client-side classes used by this JSP, do this:

    1-Install Apache AXIS
    2-produces the proxy source code

    java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java --package idecwebservices http://delta.icc.es/webservices/services/IDEC_GeoServeisPort?wsdl

    3-compiles it and places it into the CLASSES dir

    javac -classpath %AXISCLASSPATH% -g idecwebservices/*.java
    **********************************************/
    private String wsc_IDEC(double Xmin,double Ymin,double Xmax,double Ymax,int Width,int Height,String Quadrar) {
    int i=0;
    String resultat= "";
    String getError= "";

    //Idec Key
    String key="XXXXXX";

    try {
    idecwebservices.IDEC_Web ServicesLocator rutaService = new idecwebservices.IDEC_Web ServicesLocator();
    idecwebservices.IDEC_Web ServicesPortType serviceIDEC= rutaService.getIDEC_Web ServicesPort();
    idecwebservices.Pixelquadrat r ;

    r=serviceIDEC.getQuadrarPixel(key,Xmin,Ymin,Xmax,Ymax,Width,Height,Quadrar);

    resultat+=r.getXmin()+"<br>";
    resultat+=r.getYmin()+"<br>";
    resultat+=r.getXmax()+"<br>";
    resultat+=r.getYmin()+"<br>";
    resultat+=r.getWidth()+"<br>";
    resultat+=r.getHeight()+"<br>";

    }
    catch(Exception e1){
    getError= "<font color=red>ERROR: <xm" + "p>" + e1 + "</x" + "mp></font>\n";
    }

    return resultat + getError;

    }
    %>

    <%

    double Xmin=498079.12;
    double Ymin=4623356.5;
    double Xmax=504552.28;
    double Ymax=4627937.0;
    int Width=300;
    int Height =300;
    String Quadrar ="QXmin";

    /*Quadratura values
    QXmin
    QYmin
    QXmax
    QYmax
    QWidth
    QHeight
    */

    String result= wsc_IDEC(Xmin,Ymin,Xmax,Ymax,Width,Height,Quadrar);
    out.print(result);
    %>


  • Download JSP examples and idecservices.jar

Users registration

To be registered, please send an e-mail to idec@icc.cat with this information (all required):
Subject: Web Services register
Name:
Surname:
e-mail:
company/Institution:

Centre de suport IDEC | Institut Cartogrāfic de Catalunya | Parc de Montjuīc- 08038 Barcelona | Tel. +34 93 567 15 00 - Fax. +34 93 567 15 67 e-mail: idec@icc.cat