Discussion:
WMSGetFeatureInfo popups
(too old to reply)
ward
2011-10-16 05:12:58 UTC
Permalink
I really need your help ppl

I've build a simple map using openlayers and geoserver
it handles one layer from the geoserver
I want to create a pop up feature so when i click on a point , a pop up will
appear with point's data
i follow this example :
http://openlayers.org/dev/examples/getfeatureinfo-popup.html
its source :
view-source:http://openlayers.org/dev/examples/getfeatureinfo-popup.html


then i created a proxy using php :
<?php
$url=$_GET["url"];
$res = file_get_contents($url);
echo $res;
?>
and put it with the map code in the same folder

the pop ups appear but they are empty!
the error msg : element not found

now,
1- did i miss something ?
2- does the proxy right ? i've no experience with php and am not sure about
the syntax .. do i have to replace GET["url"]; with
GET["http://localhost:8080/geoserver/wms"]; ?
3- do i have to put the code and the proxy in geoserver folder ?

any sign it would be very helpful

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6897072.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
ward
2011-10-16 06:19:37 UTC
Permalink
does my post visible ?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6897160.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
ward
2011-10-16 09:00:10 UTC
Permalink
dخ I have to use apache or iis or something ?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6897361.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Gabriele Seitz
2011-10-17 06:09:42 UTC
Permalink
Hi,

as to the proxy, follow this example:
http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost.
It's written in python.

code and proxy in same folder is okay, to put them on the same domain is
necessary.

Gabriele





--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6899369.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
ward
2011-10-18 06:16:20 UTC
Permalink
thank you very much for your response

OK I've downloaded this proxy and put it in cgi-bin folder in apache
also I put the code in htdocs folder
without any changes in conf

I noticed that the first line in the proxy is : #!/usr/bin/env python
so I've installed python on my PC, and replaced that line with:
#!C:\Python31\python.exe

the result is popup contains this msg : Internal Server Error, The server
encountered an internal error or misconfiguration and was unable to complete
your request... etc

also when I tried to reach the proxy directly : http://localhost/proxy.cgi
I got the "The webpage cannot be found" page


what else do i need ?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6903383.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
ward
2011-10-18 06:29:54 UTC
Permalink
thank you very much for your response

OK I've downloaded this proxy and put it in cgi-bin folder in apache
also I put the code in htdocs folder
without any changes in conf

I noticed that the first line in the proxy is : #!/usr/bin/env python
so I've installed python on my PC, and replaced that line with:
#!C:\Python31\python.exe

the result is popup contains this msg : Internal Server Error, The server
encountered an internal error or misconfiguration and was unable to complete
your request... etc

also when I tried to reach the proxy directly :
http://localhost/cgi-bin/proxy.cgi
I got the the same msg


what else do i need ?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6903405.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Robert Sanson
2011-10-18 19:38:09 UTC
Permalink
Try:

#!C:/Python31/python.exe -u

note forward rather than backward slashes

Robert
thank you very much for your response

OK I've downloaded this proxy and put it in cgi-bin folder in apache
also I put the code in htdocs folder
without any changes in conf

I noticed that the first line in the proxy is : #!/usr/bin/env python
so I've installed python on my PC, and replaced that line with:
#!C:\Python31\python.exe

the result is popup contains this msg : Internal Server Error, The server
encountered an internal error or misconfiguration and was unable to complete
your request... etc

also when I tried to reach the proxy directly :
http://localhost/cgi-bin/proxy.cgi
I got the the same msg


what else do i need ?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6903405.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
***@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted Security.
www.websense.com
ward
2011-10-18 06:38:08 UTC
Permalink
I've just added 'localhost' and 'localhost:8080' to the allowedHosts in the
proxy file
also tried #!C:\Python31\python.exe -u insted of #!C:\Python31\python.exe

nothing changed

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6903424.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
adimopoulos
2011-10-18 07:05:43 UTC
Permalink
If I understand correctly the layer you are requesting info from is served by
your local geoserver. Then there is no need for setting a proxy. You just
need to add something like

info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'your URL ',
title: 'Identify features by clicking',
queryVisible: true,
eventListeners: {
getfeatureinfo: function(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
}
}
});
map.addControl(info);
info.activate();

Hope this helped

Aris

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6903500.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
ward
2011-10-18 07:26:42 UTC
Permalink
thank you so much adimopoulos,

there is no need for now but it'll be necessary in the future
so i need to try it now

I've found that i could use a php proxy instead of cgi
did anyone try that ?


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6903543.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
ward
2011-10-18 07:00:22 UTC
Permalink
in the proxy file,
I removed the hash in front of #AddHandler cgi-script .cgi
also add this option :
Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI
MultiViews
by following these steps
http://www.webstuffscan.com/2006/12/21/accessing-blocked-websites-use-your-own-proxy-server-at-home/

still nothing's changed

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6903489.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Shadin
2011-10-29 13:41:03 UTC
Permalink
thank you alot guys
i'll try and let you know the result

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6943322.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Arnie Shore
2011-10-29 15:08:52 UTC
Permalink
Noob stuff, again: My application will use a single projection
throughout, with a lot of LonLats involved. I thought I'd write a
single transform/projection function but the mechanics of doing so is
throwing me.

I suspect the basic concept may well be wrong, but here's the function,
which I hope will return an object.

function mylonlatproj (_lon_in, _lat_in) {
return new OpenLayers.LonLat((_lon_in ,_lat_in).transform( new
OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));
}

To be called as, say,
map.setCenter(mylonlatproj(_lon,_lat), map.getProjectionObject(),
_zoom);

But this raising the following error in IE:
Object doesn't support property or method 'transform'

How do I fix that? Thanks for any assist, all. AS
Rossko
2011-10-29 17:01:49 UTC
Permalink
Have a careful look at your brackets

return new OpenLayers.LonLat((_lon_in ,_lat_in).transform( new
OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));

This will try to get something from (x,y).transform(blah)
I'm not honestly sure javascript makes of an object (x,y) but I bet it
doesn't have a .transform method.

Presuming you're trying to use LonLat .transform method, try something like
return new OpenLayers.LonLat(_lon_in ,_lat_in).transform( new
OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());



--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-popups-tp6897072p6943818.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Arnie Shore
2011-10-29 17:19:49 UTC
Permalink
I'm sure you're right; I hadn't thought through what I wanted returned,
but a transformed LonLat object makes sense to me.

Thanks so much. AS
Post by Rossko
Have a careful look at your brackets
<snip>
Post by Rossko
Presuming you're trying to use LonLat .transform method, try something like
return new OpenLayers.LonLat(_lon_in ,_lat_in).transform( new
OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
Arnie Shore
2011-10-29 21:29:41 UTC
Permalink
I'd like to determine the size of a icon from within a function (for
computing its offset) It appears to me that I need its name or id.

What are the mechanics of assigning a name or id, given =>
new OpenLayers.Icon()?

Or is there some better way?

Thanks, all. AS

Continue reading on narkive:
Loading...