AW: [mapserver-users] Query feature using openlayers and mapserver
Arnd Wippermann
arnd.wippermann at web.de
Tue Nov 3 10:41:23 PST 2009
Hi,
Look for the visibility of your "querylayer" and decide what to do
map.events.register('click', map, function (e)
{
var flag=map.getLayersBy("name", "querylayer")[0].visibility;
if(flag)
{
var url = "http://localhost/cgi-bin/mapserv.exe"
+ "?map=map/file/directory.map"
+ "&REQUEST=GetFeatureInfo"
+ "&VERSION=1.1.1"
+ "&EXCEPTIONS=application/vnd.ogc.se_xml"
+ "&BBOX="
+ map.getExtent().toBBOX()
+ "&X=" + e.xy.x
+ "&Y=" + e.xy.y
+ "&INFO_FORMAT=text/html"
+ "&QUERY_LAYERS=querylayer"
+ "&LAYERS=querylayer"
+ "&FEATURE_COUNT=1"
+ "&SRS=EPSG:4269"
+ "&STYLES="
+ "&WIDTH=" + map.size.w
+ "&HEIGHT=" + map.size.h;
window.open(url, "getfeatureinfo",
"location=0,status=0,scrollbars=1,width=600,height=400");
}
});
Regards,
Arnd
-----Ursprüngliche Nachricht-----
Von: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag von Aypes
Gesendet: Dienstag, 3. November 2009 02:50
An: mapserver-users at lists.osgeo.org
Betreff: Re: [mapserver-users] Query feature using openlayers and mapserver
I have solved the problem. There is the function code in my html:
map.events.register('click', map, function (e) {
var url = "http://localhost/cgi-bin/mapserv.exe"
+ "?map=map/file/directory.map"
+ "&REQUEST=GetFeatureInfo"
+ "&VERSION=1.1.1"
+ "&EXCEPTIONS=application/vnd.ogc.se_xml"
+ "&BBOX="
+ map.getExtent().toBBOX()
+ "&X=" + e.xy.x
+ "&Y=" + e.xy.y
+ "&INFO_FORMAT=text/html"
+ "&QUERY_LAYERS=querylayer"
+ "&LAYERS=querylayer"
+ "&FEATURE_COUNT=1"
+ "&SRS=EPSG:4269"
+ "&STYLES="
+ "&WIDTH=" + map.size.w
+ "&HEIGHT=" + map.size.h;
window.open(url,
"getfeatureinfo",
"location=0,status=0,scrollbars=1,width=600,height=400"
);
But if I turn off the layer, I click on the map, a new window still come
out. That is not the problem. The problem is the turned off layer can still
be queried. I want that the turned off layer is not queryable.
New window can still come out without any information. Please give me a
hand.
Thanks,
Aypes
--
View this message in context:
http://n2.nabble.com/Query-feature-using-openlayers-and-mapserver-tp3910093p
3936077.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list