[Qgis-user] QGIS Server a GetFeatureInfo request problems. Not sure what I am missing.

Andreas Neumann a.neumann at carto.net
Tue Jan 21 05:49:24 PST 2014


Peter,

I think you are just missing the map parameter. Should be:

map=/path/to/your/projectfile.qgs

This is essential, as otherwise QGIS server doesn't know which project
you are refering to.

As Alex said, this is a vendor-specific parameter. Alternatively to the
map parameter you can use a technique in Apache called URL-rewriting,
decribed in the README of QGIS web client. This rewrites the URL so that
the map parameter gets added.

Andreas

Am 21.01.2014 14:41, schrieb Peter Len:
> Alex - Good idea with the Firebug.  This is what I found....  The first URL is the one being sent to the QGIS Server (returns no results) and the second one is the URL that gets sent to GeoServer (returns results):
> 
> http://localhost:8090/qgis/qgis_mapserv.fcgi.exe?LAYERS=location_view&QUERY_LAYERS=location_view&STYLES=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-215.683594%2C-59.238281%2C215.683594%2C59.238281&FEATURE_COUNT=10&HEIGHT=337&WIDTH=1227&FORMAT=image%2Fpng&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A4326&X=650&Y=106
> 
> http://localhost:8080/geoserver/Postgres/wms?LAYERS=Postgres%3Alocation_view&QUERY_LAYERS=Postgres%3Alocation_view&STYLES=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-215.683594%2C-59.238281%2C215.683594%2C59.238281&FEATURE_COUNT=10&HEIGHT=337&WIDTH=1227&FORMAT=image%2Fpng&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A4326&X=650&Y=106
> 
> You can see that both URLs contain the same parameters and values, except that the call to the GeoServer contains a workspace name with the layer name.  Just as a test, I added the workspace name to the QGIS Server URL but that simply failed because it was an incorrect reference.  The QGIS Server URL is going to a QGIS project file which contains a layer that comes from my GeoServer.  So, in the end, we are talking about the same data set for both URLs, except one is going through QGIS Server as a pass-through to the GeoServer.
> 
> So, given that there does not seem to be an issue with the URL or its parameters per se, I would have to believe that there must be some something within the QGIS Server configuration.  I understand that QGIS Server is supposed to handle GetFeatureInfo requests so I must be missing something in the QGIS Server configuration, some extra parameter in the URL, or ????
> 
> Any new thoughts from the QGIS Server gurus?
> 
> Thanks - Peter
> 
>  
> 
> 
> 
> 
> 
> -----Original Message-----
>> From: Alex Mandel <tech_dev at wildintellect.com>
>> Sent: Jan 20, 2014 7:49 PM
>> To: Peter Len <peteralen at earthlink.net>, qgis-user at lists.osgeo.org
>> Subject: Re: [Qgis-user] QGIS Server a GetFeatureInfo request problems. Not sure what I am missing.
>>
>> The method I use to troubleshoot these kinds of things involves using
>> the Firebug extension in Firefox. Where you can see what the WMS request
>> being sent looks like (NET tab), copy and paste it, manipulate it by
>> hand until it works and then figure out how to make Openlayers send it
>> that way.
>>
>> Thanks,
>> Alex
>>
>> On 01/20/2014 12:44 PM, Peter Len wrote:
>>> Alex - Thanks for the reply.  Initially, I was trying to run this test using a project file where I used the "map" parameter in the layer definition.  This got the layers to display within OpenLayers but the GetFeatureInfo request was not working.  I then went back to having the project file in the QGIS Server's bin directory so that no file name has to be listed.  That is the setup I was using in the examples I provided.  I went back and ran another test when using a file at some path and used your "vendorParams" example, but the outcome is the same.  
>>>
>>>
>>> -----Original Message-----
>>>> From: Alex Mandel <tech_dev at wildintellect.com>
>>>> Sent: Jan 20, 2014 3:34 PM
>>>> To: Peter Len <peteralen at earthlink.net>, qgis-user at lists.osgeo.org
>>>> Subject: Re: [Qgis-user] QGIS Server a GetFeatureInfo request problems. Not sure what I am missing.
>>>>
>>>> On 01/20/2014 12:19 PM, Peter Len wrote:
>>>>> I am using QGIS Server that is running in my OSGeo Apache web server (on Windows 7).  Not sure what version the QGIS Server is but it was from the latest OSGeo4W installer.  I was testing an OpenLayers client to view a QGIS Desktop project file over WMS from the QGIS Server.  All seems good with that.  For example, my OpenLayers code to get  this looks like:
>>>>>
>>>>> var url = "http://localhost:8090/qgis/qgis_mapserv.fcgi.exe";
>>>>> var layer = new OpenLayers.Layer.WMS( "Main Layer", url, {
>>>>> 	layers: 'table_poly,location_view',
>>>>> 	format: 'image/png',
>>>>>    },
>>>>>    {
>>>>>        buffer: 1, 
>>>>> 	isBaseLayer: true, 
>>>>>        graphicZIndex: 0, 
>>>>>    }
>>>>> );
>>>>> map.addLayers([layer]);
>>>>>
>>>>> With the above, I can view my layers within OpenLayers.  My next test was to see if I could get the feature info from items on my layers.  I found an example of how to make this call in OpenLayers and it looks like:
>>>>>
>>>>> var info = new OpenLayers.Control.WMSGetFeatureInfo({
>>>>>                           url: url,
>>>>>                           title: 'Identify features by clicking',
>>>>>                           queryVisible: true,
>>>>>                           eventListeners: {
>>>>>                             getfeatureinfo: function(event) {
>>>>>                                 alert("Got feature info");                         
>>>>>                             }
>>>>>                          }
>>>>>                       });
>>>>> map.addControl(info);
>>>>> info.activate();
>>>>>
>>>>> When I tried this, I didn't get anything except a spinning cursor.  I then tried another test to see if that was the correct way to ask for feature info so I changed the URL for the layers to get the layers from my GeoServer rather than from QGIS Server (the project file got these layers initially from GeoServer so we are talking about the same layer source).  That worked just fine and I was able to get individual feature information.  After switching back to point to my QGIS Server I started to look at the Apache web server logs and the GeoServer output screen.  The Apache logs didn't list anything related but the GeoServer console listed the following:
>>>>>
>>>>
>>>> WMS GetFeatureInfo in OpenLayers does in fact work with QGIS Server with
>>>> one trick, vendorParams you need to specify the qgs file to reference.
>>>>
>>>> infoControls = {
>>>>            click: new OpenLayers.Control.WMSGetFeatureInfo({
>>>>                url: "http://yoursite.com/cgi-bin/qgis_mapserv.fcgi",
>>>>                title: 'Identify features by clicking',
>>>>                layers: [yourlayer],
>>>>                queryVisible: true,
>>>>                vendorParams:{map:"/path/to/map/project.qgs"}
>>>>            }),
>>>>
>>>>
>>>> Thanks,
>>>> Alex
>>>
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>>
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
> 




More information about the Qgis-user mailing list