feature-id in getfeatureinfo requests

Richard Duivenvoorde rdmailings at DUIF.NET
Tue Feb 6 07:54:47 EST 2007


Daniel, Bart,

"with a little help from my friends"

I finally managed to retrieve the oid from my postgresql/postgis table 
in the gml getfeatureinfo output.

Bart suggested to add the oid in a sub select clause, and now I receive 
the oid as a 'normal' property/attribute in the gml using the following 
DATA clause in the mapfile:

DATA 'the_geom FROM (select *, oid from "public"."testpoints") as foo 
using unique oid using SRID=28992'

By the way: I REALLY wanted to see this oid in the gml because if I did 
INFO_FORMAT: 'text/plain' I could see the oid (id) in the output.

So: I think there is a discrepancy in the expected output of both gml or 
text, isnt't it?

Anyway,
Thanks all for your help






Daniel Morissette wrote:
> Sorry, I take my suggestion back. I just got confirmation from SteveL 
> that support for _index had been removed. See his comment at 
> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1413#c5
> 
> With respect to why you don't see the OID column in your queries, I am 
> not familiar enough with PostgreSQL/PostGIS to tell what's going wrong.
> 
> Daniel
> 
> Richard Duivenvoorde wrote:
>> Thanks Daniel,
>> but
>> Nope, tried and failed :-(
>>
>> Maybe it has something to do with the way I created the table:
>>
>> CREATE TABLE testpoints
>> (
>>   waarnemer character varying(40),
>>   plaats character varying(40),
>>   soort character varying(40),
>>   aantal integer,
>>   aantal2 character varying(40),
>>   opmerking character varying(200),
>>   the_geom geometry,
>>   CONSTRAINT testpoints_pkey PRIMARY KEY (oid),
>>   CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
>>   CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 
>> 'POINT'::text OR the_geom IS NULL),
>>   CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 28992)
>> )
>> WITH OIDS;
>> ALTER TABLE testpoints OWNER TO postgres;
>>
>> I wanted to have a table in which I had an auto incrementing 
>> id-column. This was the way to do that (according to mr Google :-) )
>>
>> If I look at the table with pgAdmin III there is a column 'oid' with 
>> the id's in it. If I look with QGIS there is a column 'id'...
>>
>> But if I do:
>> SELECT
>>     a.attnum,
>>     a.attname AS field,
>>     t.typname AS type,
>>     a.attlen AS length,
>>     a.atttypmod AS lengthvar,
>>     a.attnotnull AS notnull
>> FROM
>>     pg_class c,
>>     pg_attribute a,
>>     pg_type t
>> WHERE
>>     c.relname = 'testpoints'
>>     and a.attnum > 0
>>     and a.attrelid = c.oid
>>     and a.atttypid = t.oid
>> ORDER BY a.attnum
>>
>> I don't see the oid column either....
>>
>> It probably has something to do with the special meaning of an oid 
>> column in postgresql???
>>
>> I will try to update my mapserver to the newest version (working with 
>> 4.8.3 now...) and see if that works.
>> Other solution: add my own id's of use a sequence instead of this 
>> autoincrementing... Any postgresql guru's around?
>>
>>
>> Thanks, Richard
>>
>>
>> Daniel Morissette wrote:
>>> Or pehaps try
>>>
>>> METADATA
>>>    "gml_featureid" "_index"
>>> END
>>>
>>> as suggested in bug 1413, comment #1:
>>> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1413#c1
>>>
>>> I don't think this is mentioned anywhere in the docs, if this really 
>>> works then a note about this should be added to the gml_featureid 
>>> defn' at 
>>> http://mapserver.gis.umn.edu/docs/howto/wfs_server/?searchterm=gml_featureid 
>>>
>>>
>>> Daniel
>>>
>>>
>>>
>>> Bart van den Eijnden (OSGIS) wrote:
>>>> Ah right, and how about:
>>>>
>>>> gml_featureid "oid"
>>>>
>>>> ?
>>>>
>>>> If this does not work, can you post your DATA statement?
>>>>
>>>> Best regards,
>>>> Bart
>>>>
>>>> -- 
>>>> Bart van den Eijnden
>>>> OSGIS, Open Source GIS
>>>> http://www.osgis.nl
>>>>
>>>>
>>>> --------- Oorspronkelijk bericht --------
>>>> Van: Richard Duivenvoorde <rdmailings at duif.net>
>>>> Naar: Bart van den Eijnden OSGIS <bartvde at OSGIS.NL>,
>>>> MAPSERVER-USERS at LISTS.UMN.EDU <MAPSERVER-USERS at LISTS.UMN.EDU>
>>>> Onderwerp: Re: [UMN_MAPSERVER-USERS] feature-id in getfeatureinfo 
>>>> requests
>>>> Datum: 05/02/07 13:25
>>>>
>>>>> Hi Bart,
>>>>>
>>>>> Thanks for the quick response :-)
>>>>>
>>>>> I tried that already, but in the text output, I see ALL columns of 
>>>>> the table (though not the 'oid' as a normal 'attribute') in the 
>>>>> output. But there is this line:
>>>>> 'Feature 17246'
>>>>> Which IS the oid/feature_id....
>>>>>
>>>>> In the gml I also receive ALL columns in the output, but NO 
>>>>> reference to this 17246 oid/feature_id/id...
>>>>>
>>>>> I tried all these:
>>>>>        &quot;ows_include_items&quot; &quot;all&quot;
>>>>>        &quot;gml_include_items&quot; &quot;all&quot;
>>>>>        &quot;wms_include_items&quot; &quot;all&quot;
>>>>> ....
>>>>>
>>>>> is the oid-column not an official attribute column or something 
>>>>> like that?
>>>>>
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>> Bart van den Eijnden (OSGIS) wrote:
>>>>> &gt; Hi Richard,
>>>>> &gt; &gt; you need to add &gt; &gt; GML_INCLUDE_ITEMS &quot;all&quot;
>>>>> &gt; &gt; to your LAYER's METADATA section.
>>>>> &gt; &gt; Best regards,
>>>>> &gt; Bart
>>>>> &gt; &gt; --
>>>>> &gt; Bart van den Eijnden
>>>>> &gt; OSGIS, Open Source GIS
>>>>> &gt; http://www.osgis.nl
>>>>> &gt; &gt; &gt; --------- Oorspronkelijk bericht --------
>>>>> &gt; Van: Richard Duivenvoorde &lt;rdmailings at DUIF.NET&gt;
>>>>> &gt; Naar: MAPSERVER-USERS at LISTS.UMN.EDU
>>>> &lt;MAPSERVER-USERS at LISTS.UMN.EDU&gt;
>>>>> &gt; Onderwerp: [UMN_MAPSERVER-USERS] feature-id in getfeatureinfo
>>>> requests
>>>>> &gt; Datum: 05/02/07 13:01
>>>>> &gt; &gt;&gt; Hi All,
>>>>> &gt;&gt;
>>>>> &gt;&gt; busy using getfeatureinfo from a postgresql/postgis layer.
>>>>> &gt;&gt;
>>>>> &gt;&gt; Mapserver version 4.8.3 (...)
>>>>> &gt;&gt; Postgresql-table is a point table and has a oid column 
>>>>> (create
>>>> script
>>>>> &gt;&gt; with 'WITH OIDS').
>>>>> &gt;&gt;
>>>>> &gt;&gt; I managed to get the getfeatureinfo up and running, but 
>>>>> stumble
>>>> upon the
>>>>> &gt;&gt; missing (feature)-id in the gml output:
>>>>> &gt;&gt;
>>>>> &gt;&gt; When I do an info format of 'text/plain' I'll receive 
>>>>> something
>>>> like:
>>>>> &gt;&gt;
>>>>> &gt;&gt; GetFeatureInfo results:
>>>>> &gt;&gt; Layer 'testpoints'
>>>>> &gt;&gt;    Feature 17246:
>>>>> &gt;&gt;      bla = 'zyz'
>>>>> &gt;&gt;      foo= ''
>>>>> &gt;&gt;
>>>>> &gt;&gt; but when i ask for 'application/vnd.ogc.gml' as info format I
>>>> receive
>>>>> &gt;&gt; gml without the feature-id (not even as a normal 'oid'
>>>> property??):
>>>>> &gt;&gt;
>>>>> &gt;&gt; &amp;lt;?xml version=&amp;quot;1.0&amp;quot;
>>>> encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;
>>>>> &gt;&gt; &amp;lt;msGMLOutput
>>>>> &gt;&gt;      xmlns:gml=&amp;quot;http://www.opengis.net/gml&amp;quot;
>>>>> &gt;&gt;      
>>>>> xmlns:xlink=&amp;quot;http://www.w3.org/1999/xlink&amp;quot;
>>>>> &gt;&gt;    
>>>> xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt; 
>>>>
>>>>> &gt;&gt;     &amp;lt;testpoints_layer&amp;gt;
>>>>> &gt;&gt;         &amp;lt;testpoints_feature&amp;gt;
>>>>> &gt;&gt;             &amp;lt;gml:boundedBy&amp;gt;
>>>>> &gt;&gt;                 &amp;lt;gml:Box
>>>> srsName=&amp;quot;EPSG:28992&amp;quot;&amp;gt;          
>>>>> &gt;&gt; &amp;lt;gml:coordinates&amp;gt;67349.250981,549785.660401 
>>>>> &gt;&gt; 67349.250981,549785.660401&amp;lt;/gml:coordinates&amp;gt;
>>>>> &gt;&gt;                 &amp;lt;/gml:Box&amp;gt;
>>>>> &gt;&gt;             &amp;lt;/gml:boundedBy&amp;gt;
>>>>> &gt;&gt;             &amp;lt;bla&amp;gt;zyz&amp;lt;/bla&amp;gt;
>>>>> &gt;&gt;             &amp;lt;foo&amp;gt;&amp;lt;/foo&amp;gt;
>>>>> &gt;&gt;         &amp;lt;/testpoints_feature&amp;gt;
>>>>> &gt;&gt;     &amp;lt;/testpoints_layer&amp;gt;
>>>>> &gt;&gt; &amp;lt;/msGMLOutput&amp;gt;
>>>>> &gt;&gt;
>>>>> &gt;&gt; Am I missing some metadata property in my mapfile? I would 
>>>>> expect
>>>> either
>>>>> &gt;&gt; a feature-id attribute in the testpoints_feature element, OR
>>>> oid-element
>>>>> &gt;&gt;   as child of the testpoints_feature element.
>>>>> &gt;&gt;
>>>>> &gt;&gt; TIA,
>>>>> &gt;&gt;
>>>>> &gt;&gt; Richard
>>>>> &gt;&gt;
>>>>> &gt;&gt;
>>>>> &gt; &gt;
>>>>>
>>>>>
>>>
>>>
> 
> 



More information about the mapserver-users mailing list