[OpenLayers-Users] GetFeatureInfo problems

Arnd Wippermann arnd.wippermann at web.de
Sun Jan 20 16:33:37 EST 2008


Hi Maria,

First I would think, your query have no results to return.

You need only a proxy, if you want to display the result of your query in a
html-element of your page. Because you have to get the file, parse it and
put it into your page. If you use window.open(url), then you don't need a
proxy. But for div's etc., there is no property "src", where you can put
your url (like the img src).

When all runs on the same pc, you don't need a proxy, but you always have to
use the same domain. Localhost is not the same as 127.0.0.1 etc.

Why your GetFeatureInfoRequest wants to display as xml, i have no clue. You
need no header and footer and in the mapfile you have declared text/html.
It's all there. 

text/plain and gml seems to work, but the query returns no result.

If the map snippet is that, what you use, then you have to include in the
METADATA tag
"wms_name" "Quakes". This is the link to the layer not wms_title.


Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/


 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Maria Panagou
Gesendet: Sonntag, 20. Januar 2008 19:53
An: users at openlayers.org
Betreff: [OpenLayers-Users] GetFeatureInfo problems


i'm trying to include a GetFeatureInfo query in my Openlayers app. In my
html I have included the following code for onclick event :

map.events.register('click', map, function (e) {
            OpenLayers.Util.getElement('nodeList').innerHTML = "Loading...
please wait...";
            var url =  quakes.getFullRequestString({
                            REQUEST: "GetFeatureInfo",
                            EXCEPTIONS: "application/vnd.ogc.se_xml",
                            BBOX: quakes.map.getExtent().toBBOX(),
                            X: e.xy.x,
                            Y: e.xy.y,
                            INFO_FORMAT: 'text/html',
                            QUERY_LAYERS: 'Quakes',
			    layers:'Quakes',
                            WIDTH: map.size.w,
                            HEIGHT: map.size.h});
            OpenLayers.loadURL(url, '', this, setHTML,setHTML);
            OpenLayers.Event.stop(e);
      });
    function setHTML(response) { 
        OpenLayers.Util.getElement('nodeList').innerHTML =
response.responseText;
        }

upon clicking on my point layer "Quakes" which is to be queried, i get no
results, just the loading..please wait text and I get the following error in
firebug

[Exception... "'Permission denied to call method XMLHttpRequest.open' when
calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]

I've read about that it could be a proxy host problem but I don't think that
that is my case since the layer to query is at the same server as my mapfile
and PostGIS database. However I tried to setup a proxy host on the server,
which seems to work fine, but it doesn't correct the error message. Do i
really need a proxy host? 

Next step, I tried to query the server localy issuing the following
GetFeatureInfo request :
http://127.0.0.1/cgi-bin/mapserv.exe?map=../htdocs/mpanagou/Quakes1.map&LAYE
RS=Quakes&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&QUERY_LAYERS=Quak
es&STYLES=&EXCEPTIONS=application/vnd.ogc.se_xml&X=185&Y=194&FORMAT=image/pn
g&SRS=EPSG:4326&INFO_FORMAT=text/html&WIDTH=650&HEIGHT=530&BBOX=19.2,34.5,29
.8,42.1

it doesn't work however i think due to a different reason. When using
INFO_FORMAT=text/html, i am prompted to open/save  a file containing:

<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?> <!DOCTYPE
ServiceExceptionReport SYSTEM
"http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1"> <ServiceException>
</ServiceException> </ServiceExceptionReport>

when using INFO_FORMAT=text/plain i get the message

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then
click the Refresh button, or try again later. 

----------------------------------------------------------------------------
----

Invalid at the top level of the document. Error processing resource
'http://127.0.0.1/cgi-bin/mapserv.exe?map=../htdocs/mpa...

GetFeatureInfo results:
^
 
 and when INFO_FORMAT=application/vnd.ogc.gml I am prompted to open/save a
file whose contents are:

<?xml version="1.0" encoding="ISO-8859-1"?>

<msGMLOutput 
	 xmlns:gml="http://www.opengis.net/gml"
	 xmlns:xlink="http://www.w3.org/1999/xlink"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Quakes_layer>

Does the template which i have defined in my mapfile has anything to do with
text/plain or application/vnd.ogc.gml INFO_FORMAT or only with text/html
format?

In the error log of Mapserver,in the lase case, I can see the following
information, that indicates that a record is being found but for a reason
that i don't understand not finally shown.

msPOSTGISLayerInitItemInfo called\r
msPOSTGISLayerGetShape called for record = 721\r
msPOSTGISLayerRetrievePK(): Found schema public, table quake_small.\r
msPOSTGISLayerRetrievePGVersion(): query = select substring(version() from
12 for (position('on' in version()) - 13))\r
msPOSTGISLayerRetrievePGVersion: Version String: 8.2.4\r
msPOSTGISLayerRetrievePGVersion(): Found version 8, 2, 4\r
msPOSTGISLayerRetrievePK: query = select attname from pg_attribute,
pg_constraint, pg_class, pg_namespace where pg_constraint.conrelid =
pg_class.oid and pg_class.oid = pg_attribute.attrelid and
pg_constraint.contype = 'p' and pg_constraint.conkey[1] =
pg_attribute.attnum and pg_class.relname = 'quake_small' and
pg_class.relnamespace = pg_namespace.oid and pg_namespace.nspname = 'public'
and pg_constraint.conkey[2] is null\r
msPOSTGISLayerParseData: unique column = codee, srid='', geom_column_name =
pos, table_name=public.quake_small\r
msPOSTGISLayerGetShape: DECLARE mycursor2 BINARY CURSOR FOR SELECT
"mag"::text,"depth"::text,asbinary(force_collection(force_2d(pos)),'NDR')
from public.quake_small WHERE codee = 721 \r msPOSTGISLayerClose
datastatement: pos FROM public.quake_small\r msPOSTGISLayerClose --
query_result is NULL\r msConnPoolRelease(Quakes,user=postgres
password=manolis dbname=macroseismic host=localhost port=5432,01BBD680)\r
Error in my_thread_global_end(): 1 threads didn't exit\r

I have defined a query results template in my mapfile which is the
following:

<!-- query template -->
<html>
<head>
   <title>MapServer - ItemQuery</title>
</head>

<body bgcolor="#ffffff">
Codee: [codee]<br>
</body>
</html>

I kept it as simple as possible with only one attribute codee showing. Do i
need a header and footer template too?

The important parts of my mapfile are:

WEB
    IMAGEPATH "C:/ms4w/tmp/ms_tmp/"
    IMAGEURL "/ms_tmp/"
    LOG "C:/temp/MapServer.log"
    METADATA 
     WMS_TITLE "QuakeMap"
     TITLE="QuakeMap"

WMS_ONLINERESOURCE="http://gaia.dbnet.ece.ntua.gr/cgi-bin/mapserv.exe?map=..
/htdocs/mpanagou/Quakes1.map&"
     wms_feature_info_mime_type "text/html"
     wms_srs "EPSG:4326"
    END
  END

LAYER
    .......
    METADATA 
     WMS_TITLE="Quakes"
     wms_include_items "all"
     wms_srs "EPSG:4326"
     wms_extent "19.2 34.5 29.8 42.1"
    END
    DUMP TRUE
    TEMPLATE "Query Template results.html"
.....

I'm totally confused here. I would appreciate some help. I read a lot of
documentation and forum threads but i can't figure out the problem.





--
View this message in context:
http://www.nabble.com/GetFeatureInfo-problems-tp14985142p14985142.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list