Find an object

(fr) Cette page n’est plus maintenue depuis la version 2022 de Geoconcept Web. Pour accéder à la documentation à jour de ce web service, veuillez suivre ce lien.

Basic principles

This web service uses an object’s geographic coordinates to retrieve information contained in the fields of the object in a Geoconcept map. The call to the web service requires as parameters the layer name, the structure of the map and of the field(s) to interrogate.

Availability

This web servce is available at all times with Geoconcept Web and a Geoconcept map.

Version change

Earlier versions of the web service are conserved in Geoconcept Web to ensure compatibility with earlier software versioning and development. We recommend using the most recent version.

Changes in V2

  • The name of the web service has changed from "findObjectsUnder" to "findObjectV2"
  • The Web service is no longer available in REST GET
  • Replacement of "mapName" by "layerName"
  • Addition of several "findObjectsTarget" search parameters
  • Addition of "targetID", "maxDistance" and "maxCandidates" parameters
  • Addition of "distance" and "wktGeometry" output parameters
  • Deletion of the "topology" parameter

V2

Parameters / properties

Input

parameter description optional default

srs

projection (EPSG code such as epsg:4326 or wgs84)

no

geometries

Coordinates to find (series of Id,X,Y triplets separated by the ";" character)

no

layerName

Name of the layer to use

no

targets/target (findObjectsTarget)

Properties of searched objects

no

Targets (findObjectsTarget)

parameter description optional default

targetID

Identifier

yes

className

Name of the Class

no

subclassName

Name of the Subclass

no

fields

Name of the fields separated by the ";" character

no

maxDistance

Maximum search radius (in metres)

yes

maxCandidates

Maximum number of candidates to return

yes

Output

parameter type min/max description

id

string

0/1

Objects identifier

targets/target (findTargetResult)

array (objectInfo)

0/unlimited

Objects

Target Infos (findTargetResult)

parameter type min/max description

targetID

string

0/1

Identifier

objects/object (objectInfoV2)

string

0/unlimited

Object descriptions

Object Info (objectInfoV2)

parameter type min/max description

distance

integer

1/1

Distance in metres betwen the origin point and the found object
-1 if the calculated distance is not available

wktGeometry

string

0/1

Object geometry

SOAP

WSDL

http://<server>/<webapp>/api/ws/findObjectsService?wsdl

Query

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:findObjectV2>
         <!--Optional:-->
         <request>
            <!--Optional:-->
            <srs>epsg:4326</srs>
            <geometries>1,-1.80280,47.15524</geometries>
            <layerName>Fond de plan</layerName>
            <!--Optional:-->
            <targets>
               <!--1 or more repetitions:-->
               <target>
                  <!--Optional:-->
                  <targetId>1</targetId>
                  <className>Unité administrative</className>
                  <!--Optional:-->
                  <subClassName>Commune</subClassName>
                  <fields>Name;Code gouvernement</fields>
                  <!--Optional:-->
                  <maxDistance>1000</maxDistance>
                  <!--Optional:-->
                  <maxCandidates>5</maxCandidates>
               </target>
            </targets>
         </request>
      </sch:findObjectV2>
   </soapenv:Body>
</soapenv:Envelope>

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:findObjectV2Response xmlns:ns2="http://geoconcept.com/gc/schemas">
         <FindObjectResult>
            <status>OK</status>
            <results>
               <id>1</id>
               <targets>
                  <target>
                     <targetId>1</targetId>
                     <objects>
                        <object>
                           <fields>
                              <field>Port-Saint-Père</field>
                              <field>44133</field>
                           </fields>
                           <distance>0</distance>
                        </object>
                        <object>
                           <fields>
                              <field>Rouans</field>
                              <field>44145</field>
                           </fields>
                           <distance>447</distance>
                        </object>
                     </objects>
                  </target>
               </targets>
            </results>
         </FindObjectResult>
      </ns2:findObjectV2Response>
   </soap:Body>
</soap:Envelope>
REST (POST)

Query

Query 

http://<server>/<webapp>/api/lbs/find/findObject/v2.xml

Data (XML) 

<?xml version="1.0" encoding="UTF-8"?>
<findObjectRequestV2>
  <srs>epsg:4326</srs>
  <geometries>1,-1.80280,47.15524</geometries>
  <layerName>Fond de plan</layerName>
  <targets>
    <target>
      <targetId>1</targetId>
      <className>Unité administrative</className>
      <subClassName>Commune</subClassName>
      <fields>Name;Code gouvernement</fields>
      <maxDistance>0</maxDistance>
      <maxCandidates>1</maxCandidates>
    </target>
  </targets>
</findObjectRequestV2>

Response

The response is always in UTF-8 format.

XML format 

<findObjectResultsV2>
   <status>OK</status>
   <results>
      <id>1</id>
      <targets>
         <target>
            <targetId>1</targetId>
            <objects>
               <object>
                  <fields>
                     <field>Port-Saint-Père</field>
                     <field>44133</field>
                  </fields>
                  <distance>0</distance>
               </object>
            </objects>
         </target>
      </targets>
   </results>
</findObjectResultsV2>

Query

JSON query 

http://<server>/<webapp>/api/lbs/find/findObject/v2.json

JSON 

{
  "srs" : "epsg:4326",
  "geometries" : "1,-1.80280,47.15524",
  "layerName" : "Fond de plan",
  "targets" : [ {
  "className" : "Unité administrative",
  "subClassName" : "Commune",
  "fields" : "Name;Code gouvernement"
  }]
}

Response

The response is always in UTF-8 format.

JSON format 

{
   "message": null,
   "status": "OK",
   "results": [   {
      "id": "1",
      "targets": [{"objects": [      {
         "distance": 0,
         "fields":          [
            "Port-Saint-Père",
            "44133"
         ]
      }]}]
   }]
}

Possible responses

Case of a response that is found (findObjectsResults/status est OK) 

<findObjectResultsV2>
   <status>OK</status>
   <results>
      <id>1</id>
      <targets>
         <target>
            <targetId>1</targetId>
            <objects>
               <object>
                  <fields>
                     <field>Port-Saint-Père</field>
                     <field>44133</field>
                  </fields>
                  <distance>0</distance>
               </object>
            </objects>
         </target>
      </targets>
   </results>
</findObjectResultsV2>

Absence of an object on the position searched (findObjectsResultsV2/status is OK) 

<findObjectsResultsV2>
   <status>OK</status>
   <results>
      <id>1</id>
      <objects/>
   </results>
</findObjectsResultsV2>

Faulty projection / srs (serviceResult/status is ERROR) 

<serviceResult>
    <message>
        CoordinateTransformEngineException: Coordinate transformation failed
    </message>
    <status>ERROR</status>
</serviceResult>

Case, absence of an argument for geometries (serviceResult/status est ERROR) 

<serviceResult>
   <message>IllegalArgumentException: Geometry has too few fields : String[][{1,-1.80280}]</message>
   <status>ERROR</status>
</serviceResult>

Case of a layer that is not found (serviceResult/status is ERROR) 

<serviceResult>
   <message>WebServiceException: Layer name 'Fond de lan' does not exist</message>
   <status>ERROR</status>
</serviceResult>

Case of a Class that is not found (serviceResult/status est ERROR) 

<serviceResult>
   <message>WebServiceException: Error in finding objects
failed to execute text request
failed to execute gcis request (text response)
failed to execute gcis request
exception occured while servicing request
Failed to service request
com.geoconcept.gc.GcException: native returned exception (code=1)
native returned exception
[FindObject-88304] unknown type 'Unité administrtive'</message>
   <status>ERROR</status>
</serviceResult>

Case of a Subclass that is not found (serviceResult/status est ERROR) 

<serviceResult>
   <message>WebServiceException: Error in finding objects
failed to execute text request
failed to execute gcis request (text response)
failed to execute gcis request
exception occured while servicing request
Failed to service request
com.geoconcept.gc.GcException: native returned exception (code=1)
native returned exception
[FindObject-88305] unknown subtype 'Commun'</message>
   <status>ERROR</status>
</serviceResult>

Case of a field not found (serviceResult/status est ERROR) 

<serviceResult>
   <message>WebServiceException: Error in finding objects
failed to execute text request
failed to execute gcis request (text response)
failed to execute gcis request
exception occured while servicing request
Failed to service request
com.geoconcept.gc.GcException: native returned exception (code=1)
native returned exception
[FindObject-88300] unknown field 'Code governement'</message>
   <status>ERROR</status>
</serviceResult>

V1

Parameters / properties

Input

parameter description optional default

srs

projection (EPSG code such as epsg:4326 or wgs84)

yes

geometries

Coordinates to find (series of Id,X,Y triplets separated by the ";" character)

no

topology

Topological relationship between the geometries and the objects to find

yes

mapName

Name of the map

no

className

Name of the Class

no

subclassName

Name of the Subclass

no

fields

Name of the fields separated by the ";" character

no

Output

Objects (findObjectsResult)

parameter type min/max description

id

string

0/1

Objects identifier

objects

array (objectInfo)

0/unlimited

Objects

Object Info (objectInfo)

parameter type min/max description

fields

string

0/unlimited

Field attributes

SOAP

WSDL

http://<server>/<webapp>/api/ws/findObjectsService?wsdl

Query

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:findObjectsUnder>
         <!--Optional:-->
         <srs>epsg:4326</srs>
         <!--Optional:-->
         <geometries>1,-1.80280,47.15524</geometries>
         <!--Optional:-->
         <topology></topology>
         <!--Optional:-->
         <mapName>Loire.gcm</mapName>
         <!--Optional:-->
         <className>Unité administrative</className>
         <!--Optional:-->
         <subclassName>Commune</subclassName>
         <!--Optional:-->
         <fields>Nom;Population</fields>
      </sch:findObjectsUnder>
   </soapenv:Body>
</soapenv:Envelope>

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:findObjectsUnderResponse xmlns:ns2="http://geoconcept.com/gc/schemas">
         <FindObjectsResult>
            <status>OK</status>
            <results>
               <id>1</id>
               <objects>
                  <object>
                     <fields>
                        <field>Port-Saint-Père</field>
                        <field>2724</field>
                     </fields>
                  </object>
               </objects>
            </results>
         </FindObjectsResult>
      </ns2:findObjectsUnderResponse>
   </soap:Body>
</soap:Envelope>
REST

Query

JSON query 

http://<server>/<webapp>/api/lbs/find/under.json?srs=epsg:4326&geometries=1,-1.80280,47.15524&mapName=Loire.gcm&className=Unit%C3%A9%20administrative&subclassName=Commune&fields=Nom;Population

JSON-P query 

http://<server>/<webapp>/api/lbs/find/under.xml?srs=epsg:4326&geometries=1,-1.80280,47.15524&mapName=Loire.gcm&className=Unit%C3%A9%20administrative&subclassName=Commune&fields=Nom;Population&callback=myCallback

XML query 

http://<server>/<webapp>/api/lbs/find/under.xml?srs=epsg:4326&geometries=1,-1.80280,47.15524&mapName=Loire.gcm&className=Unit%C3%A9%20administrative&subclassName=Commune&fields=Nom;Population

Response

The response is always in UTF-8 format.

JSON format 

{
   "message":null,
   "status":"OK",
   "results":[
      {
         "id":"1",
         "objects":[
            {
               "fields":[
                  "Port-Saint-Père",
                  "2724"
               ]
            }
         ]
      }
   ]
}

JSON-P format 

myCallback({
           "message":null,
           "status":"OK",
           "results":[
                  {
                         "id":"1",
                         "objects":[
                                {
                                   "fields":[
                                          "Port-Saint-Père",
                                          "2724"
                                   ]
                                }
                         ]
                  }
           ]
        }
);

XML format 

<findObjectsResults>
        <status>OK</status>
        <results>
                <id>1</id>
                <objects>
                        <object>
                                <fields>
                                        <field>Port-Saint-Père</field>
                                        <field>2724</field>
                                </fields>
                        </object>
                </objects>
        </results>
</findObjectsResults>

Possible responses

Case of a response that is found (findObjectsResults/status est OK) 

<findObjectsResults>
        <status>OK</status>
        <results>
                <id>1</id>
                <objects>
                        <object>
                                <fields>
                                        <field>Port-Saint-Père</field>
                                        <field>2724</field>
                                </fields>
                        </object>
                </objects>
        </results>
</findObjectsResults>

Absence of an object on the searched position (findObjectsResults/status is OK) 

<findObjectsResults>
   <status>OK</status>
   <results>
      <id>1</id>
      <objects/>
   </results>
</findObjectsResults>

Faulty projection / srs (serviceResult/status is ERROR) 

<serviceResult>
    <message>
        CoordinateTransformEngineException: Coordinate transformation failed
    </message>
    <status>ERROR</status>
</serviceResult>

Case, absence of an argument for geometries (serviceResult/status est ERROR) 

<serviceResult>
   <message>IllegalArgumentException: Candidate has too few fields : [Ljava.lang.String;@5890d398</message>
   <status>ERROR</status>
</serviceResult>

Case of a map that is not found (serviceResult/status is ERROR) 

<serviceResult>
   <message>ServiceException: getLayerInfo : Error reading map info on Loir.gcm
No metadata for this map has been found</message>
   <status>ERROR</status>
</serviceResult>

Case of a Class that is not found (serviceResult/status est ERROR) 

<serviceResult>
   <message>WebServiceException: Error in finding objects
Error on ObjClass</message>
   <status>ERROR</status>
</serviceResult>

Case of a Subclass that is not found (serviceResult/status est ERROR) 

<serviceResult>
   <message>WebServiceException: Error in finding objects
Error on ObjSubclass</message>
   <status>ERROR</status>
</serviceResult>

Case of a field not found (serviceResult/status est ERROR) 

<serviceResult>
   <message>WebServiceException: Error in finding objects
Error on ObjField</message>
   <status>ERROR</status>
</serviceResult>

FAQ

1. Is it possible to use other topological relationships between objects?
2. How should we process maps with non-latin encoding?
3. Is it possible to pass several geometries when calling a Web Service?

1.

Is it possible to use other topological relationships between objects?

No, for the moment, only the Intersect relationship is available.

2.

How should we process maps with non-latin encoding?

In ADministration / Parameters, change the value of "geographics.server.gcis.gcisServerCharset" by "UTF-8".

3.

Is it possible to pass several geometries when calling a Web Service?

Yes, it will suffice to specify more triplets separated by the ";" character

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:findObjectsUnder>
         <!--Optional:-->
         <srs>epsg:4326</srs>
         <!--Optional:-->
         <geometries>1,6.01501,49.350;2,6.01701,49.390</geometries>
         <!--Optional:-->
         <topology></topology>
         <!--Optional:-->
         <mapName>geowebSmp.gcm</mapName>
         <!--Optional:-->
         <className>Pyr</className>
         <!--Optional:-->
         <subclassName>P2L2</subclassName>
         <!--Optional:-->
         <fields>Nom;X;Y</fields>
      </sch:findObjectsUnder>
   </soapenv:Body>
</soapenv:Envelope>

Return:

+

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Body>
                <ns2:findObjectsUnderResponse xmlns:ns2="http://geoconcept.com/gc/schemas">
                        <FindObjectsResult>
                                <status>OK</status>
                                <results>
                                        <id>1</id>
                                        <objects>
                                                <object>
                                                        <fields>
                                                                <field>FONTOY</field>
                                                                <field>868858</field>
                                                                <field>2489508</field>
                                                        </fields>
                                                </object>
                                        </objects>
                                </results>
                                <results>
                                        <id>2</id>
                                        <objects>
                                                <object>
                                                        <fields>
                                                                <field>HAVANGE</field>
                                                                <field>864342.4</field>
                                                                <field>2494239.52</field>
                                                        </fields>
                                                </object>
                                        </objects>
                                </results>
                        </FindObjectsResult>
                </ns2:findObjectsUnderResponse>
        </soap:Body>
</soap:Envelope>