feature-id in getfeatureinfo requests
Richard Duivenvoorde
rdmailings at DUIF.NET
Tue Feb 6 04:54:47 PST 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:
>>>>> "ows_include_items" "all"
>>>>> "gml_include_items" "all"
>>>>> "wms_include_items" "all"
>>>>> ....
>>>>>
>>>>> is the oid-column not an official attribute column or something
>>>>> like that?
>>>>>
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>> Bart van den Eijnden (OSGIS) wrote:
>>>>> > Hi Richard,
>>>>> > > you need to add > > GML_INCLUDE_ITEMS "all"
>>>>> > > to your LAYER's METADATA section.
>>>>> > > 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: MAPSERVER-USERS at LISTS.UMN.EDU
>>>> <MAPSERVER-USERS at LISTS.UMN.EDU>
>>>>> > Onderwerp: [UMN_MAPSERVER-USERS] feature-id in getfeatureinfo
>>>> requests
>>>>> > Datum: 05/02/07 13:01
>>>>> > >> Hi All,
>>>>> >>
>>>>> >> busy using getfeatureinfo from a postgresql/postgis layer.
>>>>> >>
>>>>> >> Mapserver version 4.8.3 (...)
>>>>> >> Postgresql-table is a point table and has a oid column
>>>>> (create
>>>> script
>>>>> >> with 'WITH OIDS').
>>>>> >>
>>>>> >> I managed to get the getfeatureinfo up and running, but
>>>>> stumble
>>>> upon the
>>>>> >> missing (feature)-id in the gml output:
>>>>> >>
>>>>> >> When I do an info format of 'text/plain' I'll receive
>>>>> something
>>>> like:
>>>>> >>
>>>>> >> GetFeatureInfo results:
>>>>> >> Layer 'testpoints'
>>>>> >> Feature 17246:
>>>>> >> bla = 'zyz'
>>>>> >> foo= ''
>>>>> >>
>>>>> >> but when i ask for 'application/vnd.ogc.gml' as info format I
>>>> receive
>>>>> >> gml without the feature-id (not even as a normal 'oid'
>>>> property??):
>>>>> >>
>>>>> >> <?xml version="1.0"
>>>> encoding="ISO-8859-1"?>
>>>>> >> <msGMLOutput
>>>>> >> xmlns:gml="http://www.opengis.net/gml"
>>>>> >>
>>>>> xmlns:xlink="http://www.w3.org/1999/xlink"
>>>>> >>
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>>
>>>>> >> <testpoints_layer>
>>>>> >> <testpoints_feature>
>>>>> >> <gml:boundedBy>
>>>>> >> <gml:Box
>>>> srsName="EPSG:28992">
>>>>> >> <gml:coordinates>67349.250981,549785.660401
>>>>> >> 67349.250981,549785.660401</gml:coordinates>
>>>>> >> </gml:Box>
>>>>> >> </gml:boundedBy>
>>>>> >> <bla>zyz</bla>
>>>>> >> <foo></foo>
>>>>> >> </testpoints_feature>
>>>>> >> </testpoints_layer>
>>>>> >> </msGMLOutput>
>>>>> >>
>>>>> >> Am I missing some metadata property in my mapfile? I would
>>>>> expect
>>>> either
>>>>> >> a feature-id attribute in the testpoints_feature element, OR
>>>> oid-element
>>>>> >> as child of the testpoints_feature element.
>>>>> >>
>>>>> >> TIA,
>>>>> >>
>>>>> >> Richard
>>>>> >>
>>>>> >>
>>>>> > >
>>>>>
>>>>>
>>>
>>>
>
>
More information about the MapServer-users
mailing list