[FWTools] OGR2OGR MySQL to Shapefile Truncating Decimal Places

Frank Warmerdam warmerdam at pobox.com
Mon Feb 23 15:31:24 EST 2009

Michael Thompson wrote:
> Hi All,
> I’m attempting to create a ESRI shapefile from the results of a SQL 
> query on a MySQL DB using OGR2OGR included with FWTools 2.2.8.  The 
> operation completes  without reporting any errors and the shapefile is 
> created as expected, but when I load the shapefile in ArcMap all the 
> floating point columns in the attribute table have no decimal places.  
> If I run the query in MySQL Query Browser the results contain the 
> decimal places that I expect.  I’ve tried rounding the selected columns 
> in the query to force the results to have a set number of decimal places 
> but this does not seem to change the output.
> Does anyone have any ideas as to what could be causing this behavior? 
>   I was able to work around the problem by converting the double columns 
> to chars in the query so that OGR2OGR treated them as strings, but this 
> seems messy.


I'm not sure why this would happen.  If you file a detailed ticket on the
issue, I'll have Chaitanya look into it.  I think I've heard of a similar
problem recently but I can't find an open ticket on the issue.  Perhaps
I heard from you?

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 FWTools mailing list