Opened 6 years ago

Closed 6 years ago

#7178 closed defect (fixed)

Data loss by using ogr2ogr from PG to PG

Reported by: pietror3 Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 1.11.4
Severity: major Keywords: ogr2ogr -gcp -21121 data loss
Cc:

Description

I need to use the ogr2ogr function "-gcp" to reproject cadastre data.

In one integer field i have the value "-21121".

In the result table the value is lost and becomes NULL

To reproduce the problem:

  1. Create a PostGIS 2 table as follows:
CREATE TABLE test
(
  gid serial NOT NULL, 
  the_geom geometry(Polygon,32632) NOT NULL
 )
WITH (
  FILLFACTOR=100, 
  OIDS=FALSE
);

insert into test SELECT

-21121,ST_GeomFromEWKT('SRID=32632;POLYGON((-8800 51000,-8801 51000,-8801 51001, -8800 51001, -8800 51000))');

  1. Execute this ogr2ogr command:
ogr2ogr -f "PostgreSQL"  -overwrite -gcp -9420.288 51422.775 567075.4889 5113474.963 -gcp -10002.336 51378.357 566493.639 5113425.814 -gcp -9424.302 50976.843 567076.835 5113032.44 -gcp -10001.936 50887.488 566500.857 5112935.372 -gcp -11791.324 50738.409 564712.348 5112763.644 -gcp -12173.818 50420.96 564334.033 5112441.985 -gcp -12241.761 50755.001 564261.844 5112774.25 -gcp -10729.904 50729.672 565772.677 5112770.537 -gcp -10627.643 51561.489 565868.446 5113600.644 -gcp -11116.159 51665.264 565377.795 5113701.731 -gcp -11539.514 51747.147 564953.443 5113774.944 -gcp -12272.054 51751.231 564219.526 5113774.998 -gcp -12074.576 51305.155 564425.806 5113327.041 -gcp -10285.097 50520.387 566223.155 5112562.837 -gcp -9466.626 50606.445 567039.8 5112660.122 -gcp -8632.395 50564.006 567873.537 5112628.473 -gcp -8825.575 51341.642 567670.494 5113401.48 -gcp -8739.962 51126.163 567758.968 5113189.315 -gcp -7890.074 51284.216 568605.392 5113357.807 -gcp -7607.166 50537.009 568898.186 5112613.974 -gcp -7176.944 51277.931 569320.629 5113361.666 -gcp -9828.46 50033.646 566684.166 5112082.364 -gcp -9044.404 51198.058 567458.096 5113257.417 -gcp -9630.057 51266.723 566867.147 5113318.657 -gcp -9146.03 51496.613 567349.503 5113552.075 -gcp -8993.578 51673.087 567499.541 5113729.307 -gcp -9375.881 51702.713 567112.348 5113754.815 -gcp -8657.174 51556.26 567836.149 5113619.918 -gcp -8237.275 51335.411 568258.426 5113405.475 -gcp -8388.375 51874.457 568101.966 5113940.368 -gcp -9141.908 52286.865 567342.284 5114345.179 -gcp -9184.154 52865.679 567293.028 5114922.598 -gcp -9710.144 52399.96 566774.046 5114450.81 -gcp -9908.561 52106.815 566578.928 5114155.816 -gcp -10079.465 52377.95 566401.987 5114420.19 -gcp -11333.467 50701.079 565170.392 5112733.318 -gcp -11144.944 51357.784 565351.839 5113391.798 -gcp -9296.349 53583.703 567172.205 5115637.311 -gcp -9365.709 54415.089 567092.146 5116467.114 -gcp -9081.479 54631.119 567375.564 5116689.017 -gcp -10628.729 53687.789 565837.508 5115725.815 -gcp -11105.842 54005.372 565361.673 5116036.222 -gcp -12131.949 53533.729 564339.477 5115551.575 -gcp -12414.26 54073.571 564050.557 5116090.222 -gcp -12543.711 52586.135 563938.971 5114600.906 -gcp -11886.007 52412.613 564599.241 5114439.927 -gcp -12510.17 52134.396 563979.443 5114149.962 -gcp -9095.115 50797.756 567409.677 5112855.253  -lco GEOMETRY_NAME=the_geom PG:"host=127.0.0.1 dbname=yourdb user=youruser port=5432 password=yourpassword" -nln public.result PG:"host=127.0.0.1 dbname=yourdb user=youruser port=5432 password=yourpassword" public.test
  1. Then, execute on PostGIS:
select * from public.result

The field cad_id is null.

This happens ONLY with this value -21121 and only from PG to PG.

I have tested also between SHP to SHP and SHP to PG and work.

Change History (1)

comment:1 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

This is a defect of GDAL 1.11 that has been fixed in GDAL 2.2

Note: See TracTickets for help on using tickets.