[postgis-users] digit problem about sql file.

Mike Toews mwtoews at gmail.com
Thu Feb 4 11:01:20 PST 2010


PostgreSQL has a server variable, extra_float_digits, that you can
either set up globally or per session/transaction. Read more about
extra_float_digits at:
http://www.postgresql.org/docs/current/static/runtime-config-client.html

This influences the interpretation of floating point numbers.

E.g.:

SET extra_float_digits=-4;

SELECT ('56.6313000004739'::text)::float8, ('55.6119999999646'::text)::float8;

You can edit the output of shp2pgsql to include the SET command at the
top, maybe. It is worth trying.

Also, mind you, if you leave the default extra_float_digits=0, and
cast to float4 instead, you get the same expected result:

SET extra_float_digits=0;

SELECT ('56.6313000004739'::text)::float4, ('55.6119999999646'::text)::float4;

-Mike

On 4 February 2010 00:08, Hyung Joo Lee <procarrie at imrc.kist.re.kr> wrote:
> Thanks for your answer.
>
> The following methods have been temporarily resolved.
>
> Well, basically I want to know why those symptoms appear.
>
> About two issues as if maybe I gotta know better.
>
> More I look forward to your response.
>
> ------------------------------------------------------------------------------------------------------------------------------------------
>
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of ibrahim saricicekㅍ
> Sent: Thursday, February 04, 2010 4:47 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] digit problem about sql file.
>
> Hi;
>
> use round function
>
> SELECT round(4.1255545487878546, 4);
>
> result---> 4.1256
>
> Regards...
>
> ------------------------------------------------------------------------------------------------------------------------------------------
>
> On Thu, Feb 4, 2010 at 9:40 AM, Hyung Joo Lee <procarrie at imrc.kist.re.kr> 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
>



-- 

Sent from Vancouver, British Columbia, Canada



More information about the postgis-users mailing list