[postgis-users] digit problem about sql file.

Chris Hermansen chris.hermansen at timberline.ca
Thu Feb 4 07:45:36 PST 2010


Actually the problem is not ArcGIS; the problem is that decimal floating
point numbers like 0.1 (1.0e-1) cannot exactly representable in binary
floating point, at least with a fixed number of digits, which is the
number format for coordinates in shapefiles.

Some decimal floating point numbers, like 0.5, 0.25, 0.125 (negative
powers of 2; sums of negative powers of 2) can be exactly represented in
binary.

Some people find this weird but decimal has the same problem; we cannot
represent negative powers of 3, negative powers of 7, etc) in a fixed
number of decimal digits (1/3, 1/7).

On Thu, 2010-02-04 at 10:25 +0100, Suhr, Ralf wrote:
> ArcGIS does not use floating point numbers. The conversation from intern ArcGIS number representation to Shapefile, Gml, Geodatabase, ... is the problem.
> 
> Gr Ralf
> 
> -----Ursprüngliche Nachricht-----
> Von: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] Im Auftrag von Ben Madin
> Gesendet: Donnerstag, 4. Februar 2010 09:19
> An: PostGIS Users Discussion
> Betreff: Re: [postgis-users] digit problem about sql file.
> 
> Kevin,
> 
> I suspect this is mainly an artefact of floating-point numbers, and the conversion to and storage of these points in binary format.
> 
> As an aside I also notice that your shp2pgsql command didn't include a -s flag - so you haven't defined a spatial reference system for your data. This may be fine (if it is arbitrary cartesian coordinates), but it may (I'm not sure) have implications for the storage of these values.
> 
> I'm sure others will be able to help out more.
> 
> cheers
> 
> Ben
> 
> 
> On 04/02/2010, at 15:40 , Hyung Joo Lee wrote:
> 
> > Hi all. 
> > 
> > I have a question about the decimal of shapefile that was created in Arcgis.
> > 
> > The file I have defined the coordinates of the coordinate system like (56.631 55.612)
> > 
> > That file was put in the DB using shp2pgsql( ---# shp2pgsql -a -w -S -I ###.shp table_name > ###.sql).
> > 
> > And then I checked the sql file. But the point coordinates that comes a lot more than 3-digit  like 56.6313000004739 55.6119999999646
> > 
> > I want to come out only 3-digit, so how can I do?
> > 
> > What option should I use?
> > 
> > I'll wait for the users a clear answer.
> > 
> > 
> > 
> > Best regards and thanks in advance.
> > 
> > Kevin.
> > 
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
Regards,

Chris Hermansen    ·    mailto:chris.hermansen at timberline.ca
tel+1.604.714.2878 · fax+1.604.733.0631 · mob+1.778.840.4625
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue  · Vancouver BC · Canada · V5Z 1E5





More information about the postgis-users mailing list