[OpenLayers-Users] getFeatureInfo errors

Alessandro Ferrucci alessandroferrucci at gmail.com
Tue Oct 27 16:11:25 EDT 2009


By the way, I also wanted to check the response status and when I print out
response.status it comes back 0 so the status is 0... not sure why the AJAX
call would fail when the GET request using the browser bar works fine.

thank you

alessandro ferrucci


On Tue, Oct 27, 2009 at 3:41 PM, Alessandro Ferrucci <
alessandroferrucci at gmail.com> wrote:

> hi, I actually in set the response to be HTML with "&INFO_FORMAT=text/html"
>
> in fact the response type in the header is text/html in the request.  I
> turned on firebug and I see the AJAX request and the response HTML is
> empty.  However when I copy the URL and put it straight in the browser, it
> comes back with the correct HTML.
>
>
> On Tue, Oct 27, 2009 at 3:02 PM, Shawn Oatley <shawn at niagarafalls.ca>wrote:
>
>>  If you use Firefox and Firebug, you can watch the XML request go to /
>> from the server.  Chances are, it is returning an XML object not a text
>> object.  When this happens, responseText is empty and responseXML has your
>> data.
>>
>> Shawn
>>
>>
>> >>> On 10/27/2009 at 2:18 PM, Alessandro Ferrucci <
>> alessandroferrucci at gmail.com> 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?
>>
>> Thank you very much,
>>
>>
>> --
>> Signed,
>> Alessandro Ferrucci
>>
>
>
>
> --
> Signed,
> Alessandro Ferrucci
>



-- 
Signed,
Alessandro Ferrucci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091027/f0413d9a/attachment.html


More information about the Users mailing list