[mapserver-users] DATA "table" does not find FID for WFS
Even Rouault
even.rouault at spatialys.com
Wed Oct 28 05:42:38 PDT 2015
Le mercredi 28 octobre 2015 13:24:28, Rahkonen Jukka (MML) a écrit :
> Hi,
>
> > The GML output tries to find a item/field with the name of the
> > gml_featureid. But the FID column in OGR is treated specially and not
> > reported as a regular field.
>
> I guess that it means that the issue does not affect only Spatialite, and
> the resolution would be to make GML output to try if it finds the
> "gml_featureid" field from the regular fields _OR_ from the field that is
> reported by OGR as "FID Column".
The GML output module cannot get this information back from the OGR provider.
The OGR provider would rather have to expose the FID column as a regular item,
when there's a named FID column. And when there's not, for example the OGR
Shapefile has no FID column. possibly a generic name like 'FID' (which is the
special name for the implicit FID column in OGR SQL) could be used to please
MapServer.
>
> The latter could be tried also if "gml_featureid" is missing from the
> mapfile or if it was set to " gml_featureid" "AUTO". I am not sure if this
> is a good idea or not because the native vector drivers should be adapted
> as well.
Looking at the postgis provider, it exposes all fields, excluding the geometry
field, but including the primary key column as regular fields.
>
> Should I file a Mapserver issue into Github about FID Columns getting
> hidden?
Possibly. There are also perhaps documentation advice with the workarounds I
suggested.
>
> -Jukka-
>
> Even Rouault wrote:
>
> Le mercredi 28 octobre 2015 12:12:55, Rahkonen Jukka (MML) a écrit :
> > Hi,
> >
> > I am testing with MS4W 3.1.0 and the GDAL that is included seems to be
> >
> > C:\ms4w>gdalinfo --version
> > GDAL 2.0.0, released 2015/06/14
> >
> > I believe that it should include #5781
>
> Yes, but that is irrelevant to your issue when looking closer.
>
> The GML output tries to find a item/field with the name of the
> gml_featureid. But the FID column in OGR is treated specially and not
> reported as a regular field. Which explains the error. In the case of
> "select * from table_name" as pk_uid is different from ogc_fid then it is
> just recognized as a regular column, which makes things work. So even
> "select * from table_name" isn't a guarantee that things are going to
> work. If the primary key field was named ogc_fid, you'd have to do "select
> ogc_fid as pk_uid, * from table_name" so it appears as a regular OGR
> field.
>
> > -Jukka-
> >
> > Even Rouault wrote:
> >
> > Le mercredi 28 octobre 2015 08:10:44, Rahkonen Jukka (MML) a écrit :
> > > Hi,
> > >
> > > I have noticed with Mapserver 7.0 that WFS server does not find the
> > > "gml_featureid" column if I define DATA this way:
> > >
> > > CONNECTIONTYPE OGR
> > > CONNECTION "\ms4w\apps\wms-wfs.sqlite"
> > > DATA "states"
> > >
> > > This gives a warning into GML sent by GetFeature
> > > <!-- WARNING: FeatureId item 'PK_UID' not found in typename
> > > 'states_table'. --> and featureMembers are without fid
> > > <gml:featureMember> <ms:states_table>
> > >
> > > This leads to correct result:
> > >
> > > CONNECTIONTYPE OGR
> > > CONNECTION "\ms4w\apps\wms-wfs.sqlite"
> > > DATA "select * from states"
> > >
> > > <gml:featureMember>
> > > <ms:states_table fid="states_table.1">
> > >
> > > Documentation http://www.mapserver.org/input/vector/ogr.html does
> > > not warn that defining data as "layer_name" vs. "select * from layer"
> > > could make a difference. Ogrinfo finds the FID column and reports it
> > > as: FID Column = PK_UID
> > >
> > > PK_UID is defined in the table as
> > > CREATE TABLE states (
> > > PK_UID INTEGER PRIMARY KEY AUTOINCREMENT,
> > >
> > >
> > > This looks like a bug but I am not sure if it is a Mapserver bug of
> > > GDAL bug and if it affects only Spatialite.
> >
> > You didn't specify which GDAL version is used.
> >
> > That could possibly be the following bug that was fixed in 1.11.2 and 2.0:
> > * make GetFIDColumn() work when run as first method call (#5781)
> >
> > > -Jukka Rahkonen-
> >
> > --
> > Spatialys - Geospatial professional services http://www.spatialys.com
>
> --
> Spatialys - Geospatial professional services http://www.spatialys.com
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the MapServer-users
mailing list