[mapserver-users] WFS from database WKT: CONFIG "ODBC_OGR_FID" problem with text field

Frank Warmerdam warmerdam at pobox.com
Tue Mar 9 10:40:49 EST 2010


CrispinF wrote:
> Hi all
> Mapserver 5.6 WFS generated from WKT in SQL Server 2000 database. Connecting
> with:
> CONNECTIONTYPE OGR
> CONNECTION "ODBC:username/pwd at DSNname,viewname(geometryfieldname)"
> PROCESSING "CLOSE_CONNECTION=DEFER"
> 
> All works fine for WMS, but for WFS requests I see the same SQL executed at
> the server for every record, along these lines
> Select * from viewname WHERE XMAX > 545000.00000000 AND XMIN <
> 550786.00000000 AND YMAX > 260040.00000000 AND YMIN < 270000.00000000
> which works OK for small areas, but is tragic for larger ones.

Crispin,

I have recently incorporated support for the new query mechanism in
the MapServer OGR connection type and with this it should avoid reissuing
the select for each feature requests in queries (as WFS operates).

Perhaps you could try MapServer built from the 5.6 branch or trunk?  I
do not believe this made it into 5.6.1 which I assume is the last released
MapServer.

>>From posts on these lists I realised MapServer cannot work out which is the
> PK, so I added this setting
> CONFIG "ODBC_OGR_FID" "UID"
> But IF my "UID" field is text, then it breaks my WFS completely. In the SQL
> trace I see this:
> Select * from viewname WHERE UID = 0  (which gives an error, and the WFS
> returns no records. I don't know where it makes up the 0 from, as that is
> not in my UID field - perhaps an arbitrary rowID assigned by MS?).
> Now if I make sure my table has an integer unique field, and refer to this
> in the CONFIG setting, it all works fine, but this is rather inconvenient in
> my scenario.
> I'm thinking this is a new bug in 5.6, because we used this setting in 4.10
> to make GetFeatureInfo work and it liked text fields then. 
> NB this setting with a text field also breaks GetFeatureInfo - I get an
> exception.
> Any tips on how to make this work with text field greatly appreciated, or
> perhaps confirmation that this is a bug?

OGR will certainly not work with non-integer feature ids so if your
feature id field is non-integer you should not try and convince OGR
to use it as an fid.

I'm not sure of the implications of non-integer feature ids at the
MapServer WFS level - perhaps it works fine as long as OGR does not
try to treat this value as it's own feature id.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list