[Mapserver-users] OGR shapefile and GetFeatureInfo

Frank Warmerdam warmerdam at pobox.com
Wed May 12 09:06:53 EDT 2004

bartvde at xs4all.nl wrote:
> Hi list,
> I tried using both OGR and Mapserver to open up a shapefile and to perform
> a GetFeatureInfo request on the respective WMS layer.
> The OGR layer has a lot of spaces in its result for floating point fields,
> is this intentional?
> Native Mapserver:
> <DIRNAAM>Directie 1</DIRNAAM>
> <SUM_LENGTE>96089.0100</SUM_LENGTE>
> <SUM_OPP_NE>1232716.0000</SUM_OPP_NE>
> OGR:
> <DIRNAAM>Directie 1</DIRNAAM>
> <ZBONOPP>           90.10</ZBONOPP>
> <ZBONLENGTE>           90.96</ZBONLENGTE>
> <SUM_LENGTE>        96089.0100</SUM_LENGTE>
> <SUM_OPP_NE>      1232716.0000</SUM_OPP_NE>


The OGR data driver in mapserver uses the OGR GetFieldAsString() method to
fetch all attribute values.  This internally uses the width and precision
information available from the datasource to format numeric values appropriately.
This produces alot of spaces in some cases.

I think this could be seen as an untended consequence of the underlying
technology, but not necessariliy one that is particularly bad.  If it is
seen as a problem (note it affects the item values from OGR in MapScript,
query requests and so forth too) it could be easily corrected in mapogr.cpp
by stripping white space after the call to GetFieldAsString().

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