[postgis-users] trouble shp2pgsql with numeric

Tonton to.tonton at gmail.com
Tue Nov 22 01:20:14 PST 2011


hello

i use shp2pgsql in a web mapping application to add shp file into postgis.

after uploading on the server side (in django framwork) i use this cmd

 cmd = "/usr/bin/shp2pgsql -c -s 4326 -W latin1 -g geometry
"+/pathToSHPname+" " +str(tablename)+">"+/pathToMyFile.sql"

it is working near great now but for some numeric information  in the sql
request  numbers are transform to sort of float : 2 became 2.0000000000

this is an exemple for my generate sql !

INSERT INTO "ltb"
("coef_conge","depart_lig","fc","freq_moy","freq__0","freq_moy_m","id_aire","id_station","libbelle","libelle","libell_","ligne","mode","num_type","nom_ligne","nom_statio","num_ligne","num_ligne_","sens","tps_parc","terminus_l","tps_parcou","type_acces","v_com_sytr","vitesse","id_lgn","nom_lgn","nom_stt","order","tpsatt_lgn","vit_off_km","vitcom_lgn","vitesse_km","length",geometry)
VALUES
('0.0000000000',NULL,'104','0.0000000000','0','0.0000000000','0','0',NULL,NULL,NULL,NULL,NULL,'0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0',NULL,'0.0000000000','0','18226',NULL,NULL,'31','0','0.0000000000','0.0000000000','0.0000000000','222.2906997126','0105000020E6100000010000000102000020E610000009000000E721D9B6305F1340E073BE5D7BF34640319802F44B5F13402462B73D81F34640B40C3CD08B5F1340C2FD98C68BF34640C8A0171BA45F134083D387CD8EF34640DBF078F7D05F13408FF4362192F346404248D110246013400742949695F34640BEA067CCB56013403119CEC098F346407A9371A6FD601340F5DF664A9BF34640EA04C7B160611340602BBB52A1F34640');

it is disapointing for me because sometimes the use of these data is for
label or legend and it is not great to see 2.00000000000 instead of 2 on
map or in legend part

does someone have same trouble or idea to resolv the trouble  ?

regards

T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111122/972d3dcc/attachment.html>


More information about the postgis-users mailing list