Hi,

It would be nice to be able to query WMS layers with GetFeatureInfo
requests.  DeeJUMP has implemented this feature but I have understood
that it is utilising deegree libraries. As a non-programmer I am
thinking that adding this feature to the existing WMS part of OpenJUMP
should not be extra difficult. The OGC standard text is here:
http://cite.opengeospatial.org/OGCTestData/wms/1.1.1/spec/wms1.1.1.html#
wmsops.getfeatureinfo

What needs to be done for making GetFeatureInfo requests, starting from
a situation of successfull WMS GetMap request and the returned image
being in OJ map Window is about the following.

1. Get the service GetCapabilities document handy, let's say it is found
here:
http://myserver.fi/cgi-bin/WMS?REQUEST=GetCapabilities&SERVICE=WMS&VERSI
ON=1.1.1
That is the initial query for using WMS get map so it is mostly
implemented already but I will come back to this in section 3. 
2. Take the WMS GetMap request as basis.  Let's say it is like this:
http://myserver.fi/cgi-bin/WMS?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&;
WIDTH=600&HEIGHT=400&LAYERS=parcels2008,parcels2009&TRANSPARENT=TRUE&FOR
MAT=image/png&BBOX=430000,6943000,430600,6943400&SRS=EPSG:3067&STYLES=

3. Read and parse the GetFeatureInfo part of the GetCapabilities
document that was queried in step 1:
<GetFeatureInfo>
      <Format>text/plain</Format>
      <Format>application/vnd.ogc.gml</Format>
      <DCPType>
        <HTTP>
          <Get><OnlineResource
xmlns:xlink="http://www.w3.org/1999/xlink";
xlink:href="http://myserver.fi/cgi-bin/WMS?"/></Get>
          <Post><OnlineResource
xmlns:xlink="http://www.w3.org/1999/xlink";
xlink:href="http://myserver.fi/cgi-bin/WMS?"/></Post>
        </HTTP>
      </DCPType>
    </GetFeatureInfo>

4. Build the GetFeatureInfo query from the following components:
a) Base url from step 3
http://myserver.fi/cgi-bin/WMS?
This online resource is usually the same that is used for
GetCapabilities but according to the standard it may be something else,
so the correct way would be to read and interpret the document.

b) Version number of GetFeatureInfo request, I suppose it can always be
the same that has been used for GetCapabilities and GetMap
VERSION=1.1.1

c) Request name
&REQUEST=GetFeatureInfo

d) copy of the main part of GetMap request from the step 2
&SERVICE=WMS&WIDTH=600&HEIGHT=400&LAYERS=parcels2008,parcels2009&TRANSPA
RENT=TRUE&FORMAT=image/png&BBOX=430000,6943000,430600,6943400&SRS=EPSG:3
067&STYLES=
So it is the whole GetMap request exept base url, version and request.

d) Add QUERY_LAYERS parameter.  Standard says: This parameter shall
contain at least one layer name, but may contain fewer layers than the
original GetMap request. To make things a bit more simple I think it
could always contain all the layers from the original GetMap request.

e) Add INFO_FORMAT parameter.  It is optional, but without giving it
server returns its default format and standard does not say what it
should be so perhaps it would be better if WMS client ask for a certain
format. Possible values are listed in GetFeatureInfo report in step 3.

f) Add FEATURE_COUNT parameter. It is optional but it is good to have,
because the default is 1 and that gives, for example, feature info of
just one of the overlapping polygons which are queried.

g) Add X and Y which are the pixel coordinates of the point that is
clicken on a map.

h) EXCEPTIONS parameter is optional and only supported value seems to be
"application/vnd.ogc.se_xml" so there is no need to include it.

When everything is put together the request should look like this:

http://myserver.fi/cgi-bin/WMS?VERSION=1.1.1&REQUEST=GetFeatureInfo&SERV
ICE=WMS&WIDTH=600&HEIGHT=400&LAYERS=parcels2008,parcels2009&TRANSPARENT=
TRUE&FORMAT=image/png&BBOX=430000,6943000,430600,6943400&SRS=EPSG:3067&S
TYLES=&QUERY_LAYERS=parcels2008,parcels2009&INFO_FORMAT=text/plain&FEATU
RE_COUNT=100&X=162&Y=225

This was the request part, another part would be to make OJ to parse
what is sent back from WMS server.  Standard does not order which
formats must of should be supported, but most common are propably
text/plain, text/html and INFO_FORMAT=application/vnd.ogc.gml which is
returning gml.

Well, after writing all this I believe it is not necessarily so simple
to implement.

-Jukka Rahkonen-

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to