[mapserver-users] OpenLayers JSONP getFeatureInfo
Puneet Kishor
punk.kish at gmail.com
Thu Nov 3 15:08:01 PDT 2011
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
More information about the MapServer-users
mailing list