[OpenLayers-Users] getFeatureInfo errors
Alessandro Ferrucci
alessandroferrucci at gmail.com
Wed Oct 28 09:56:44 EDT 2009
Maybe this is a dumb question but how do people manage this in production?
I looked at this web site:
http://taossa.com/index.php/2007/02/08/same-origin-policy/ that says that
the policy looks at the port number. Right now I have my geoserver instance
on the below server at port 8080 and my webapp serving the geo web pages
sits on the same host on port 8082. I eventually want to have my geoserver
on one machine and my webserver serving up the webpages on a different
machine, I can't see how I can do this given this policy (I don't see the
proxy script as a production solution).
thanks,
Alessandro Ferrucci
On Tue, Oct 27, 2009 at 7:36 PM, Christopher Schmidt <
crschmidt at metacarta.com> wrote:
> On Tue, Oct 27, 2009 at 02:18:42PM -0400, Alessandro Ferrucci wrote:
> > Hello,
> > I'm attempting to call getFeatureInfo from Openlayers to a geoserver
> > instance.
> >
> > Rigth now all I do is construct a GetFeatureInfo URL and supply that URL
> to
> > a window.open method and it works fine, below is relevant code:
> >
> > var wmsurl = "http://dialga.npc.census.gov:8080/geoserver/wms";
> >
> > map.events.register('click', map, function (e) {
> > var url = wmsurl + "?REQUEST=GetFeatureInfo" +
> > "&EXCEPTIONS=application/vnd.ogc.se_xml"
> > + "&BBOX=" + map.getExtent().toBBOX()
> > + "&X=" + e.xy.x
> > + "&Y=" + e.xy.y
> > + "&INFO_FORMAT=text/html"
> > + "&QUERY_LAYERS=cira:addresses"
> > + "&LAYERS=cira:addresses"
> > + "&FEATURE_COUNT=50"
> > + "&SRS=EPSG:900913"
> > + "&STYLES="
> > + "&WIDTH=" + map.size.w
> > + "&HEIGHT=" + map.size.h;
> >
> > window.open(url, "getfeatureinfo",
> > "location=0,status=0,scrollbars=1,width=600,height=150" );
> > });
> >
> > But now I want to be able to use OpenLayers.loadURL method to make an
> AJAX
> > request to the geoserver instance and get back the XMLHttpRequest obejct
> and
> > extract the HTMl from the responseText member.
> >
> > this is the code:
> >
> > var wmsurl = "http://dialga.npc.census.gov:8080/geoserver/wms";
> >
> > map.events.register('click', map, function (e) {
> > var url = wmsurl
> > + "?REQUEST=GetFeatureInfo"
> > + "&EXCEPTIONS=application/vnd.ogc.se_xml"
> > + "&BBOX=" + map.getExtent().toBBOX()
> > + "&X=" + e.xy.x
> > + "&Y=" + e.xy.y
> > + "&INFO_FORMAT=text/html"
> > + "&QUERY_LAYERS=cira:addresses"
> > + "&LAYERS=cira:addresses"
> > + "&FEATURE_COUNT=50"
> > + "&SRS=EPSG:900913"
> > + "&STYLES="
> > + "&WIDTH=" + map.size.w
> > + "&HEIGHT=" + map.size.h;
> >
> >
> >
> OpenLayers.loadURL(url,'',this,receiveGetFeatureInfo,receiveGetFeatureInfo);
> > });
> >
> > function receiveGetFeatureInfo(response)
> > {
> > alert("RESPONSE TEXT: " + response.responseText);
> > }
> >
> > responseText is ALWAYS empty... am I doing something wrong?
>
> Violating the Same Origin Policy.
>
> http://faq.openlayers.org/proxyhost/all/
>
> > Thank you very much,
> >
> >
> > --
> > Signed,
> > Alessandro Ferrucci
>
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
>
>
> --
> Christopher Schmidt
> MetaCarta
>
--
Signed,
Alessandro Ferrucci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091028/78cf136e/attachment.html
More information about the Users
mailing list