OGR DBF JOINS, Numeric Values now String

Frank Warmerdam warmerdam at POBOX.COM
Thu Sep 15 11:26:37 EDT 2005


On 9/15/05, Christopher R. Thorne <christhorne at sympatico.ca> wrote:
> Hello again,
> I got a OGR Join to work between a Shapefile and DBF. The DBF has much
> fewer records than what is found in the shapefile. The problem that I am
> having is that the CLASSITEM I wish to classify on the JOINED attribute
> which in the dbf is a numeric value with two decimal points. eg. 0.00
> 
> All Shapefile features that DO NOT have a successful JOIN contain a
> value 'blank'. ie. EXPRESSION "" This of course is not valid for numeric
> item 'blank' should be 0.00
> 
> Which leads into my next observation numerical values that are joined
> seem to be considered string values vs. numerical.

Chris, 

In MapServer all attribute values are strings.  In OGR joins any
join that fails results in all the joined fields being NULL in the 
merged feature.  In MapServer's OGR binding NULL fields are
treated as "" whether they are numeric or string.  

I am a bit fuzzy on how MapServer expressions work in some cases
and won't try to address that. 

If you think the OGR join is making numeric fields become strings
after the join I would suggest you check it with "ogrinfo".   If it
shows fields that were reported as numeric in the .dbf file 
being reported as string in the joined file then I would appreciate
your filing a bug on the problem.

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