[mapserver-users] OpenLayers JSONP getFeatureInfo

2011-11-03 Thread Fawcett, David (MPCA)
I posted a similar question to the OpenLayers list, but know that there isn't 
complete overlap.  

Can anyone point me to an example that uses JSONP to get around the same origin 
policy when making a getFeatureInfo request from OpenLayers to MapServer?

Is it possible?

Thanks, 

David.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] OpenLayers JSONP getFeatureInfo

2011-11-03 Thread Puneet Kishor
David,

On Nov 3, 2011, at 2:17 PM, Fawcett, David (MPCA) wrote:

 I posted a similar question to the OpenLayers list, but know that there isn't 
 complete overlap.  
 
 Can anyone point me to an example that uses JSONP to get around the same 
 origin policy when making a getFeatureInfo request from OpenLayers to 
 MapServer?
 


Not a direct answer to your question, but two alternative approaches that might 
work rather well (I used getFeatureInfo only briefly, but then gave up on it) --

1. Use something like jQuery (my Js weapon of choice) to construct an ajax 
query. A JSONP query requires just one additional letter P.

2. Use a proxy. Remember, a few days ago I was asking about how to specify 
different classes in the browser address bar (in the URI) and use that to 
specify which classes are rendered by MapServer? I solved that by using a 
proxy... just a couple of lines of Perl, and that was solved.

A bonus hint -- if your data are in Pg, don't even bother with getFeatureInfo. 
Just query the db directly and return the data as JSON (or, JSONP, in this 
case).

--
Puneet Kishor___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users