Opened 17 years ago

Closed 15 years ago

Last modified 15 years ago

#377 closed defect (fixed)

custom projection of GRASS vectors

Reported by: lami@… Owned by: homann
Priority: major: does not work as expected Milestone: Version 1.0.3
Component: GRASS Version: 0.8
Keywords: Cc: neteler, msieczka, rblazek
Must Fix for Release: No Platform: Unix
Platform Version: Awaiting user input: yes

Description

GRASS vectors with custom projections are not recognized correctly, and are interpreted as the corresponding "normal" projection. Among other things, as a result, when they are exported, .prj file is not correct. eg: +proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl +units=m +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 becomes:

+proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl +units=m +no_defs

Change History (18)

comment:1 by wonder, 17 years ago

Must Fix for Release: No

This seems to be the same problem as discussed in #418. QGIS always needs to know the proj4 string prior to using custom projection, otherwise it won't be recognized (or will be recognized incorrectly).

Try adding this projection to custom projections first. Then using this projection in QGIS should be correct. Please confirm if that helps.

Martin

comment:2 by lami@…, 17 years ago

This is what I usually do, I setted my custom projection like "Global default projection displayed below will be used" in the Settings->Options window, when I start QGIS I load a GRASS vector from a Location with the same projection but if I look in the Properties->Metadata window I see that the output and the input projection used is " +proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl +units=m +no_defs" different from my custom projection (that is the same of the Location of the vector).

If I esport to .shp the correction factors are not present in the .proj file

Regards

comment:3 by anonymous, 17 years ago

Owner: rblazek removed

comment:4 by gsherman, 17 years ago

Milestone: Version 0.8 ReleaseVersion 0.8.1 Release

comment:5 by anonymous, 17 years ago

Cc: neteler@… added

comment:6 by homann, 17 years ago

Owner: set to homann
Status: newassigned

If you could attach the GRASS vectors, I will have a look.

comment:7 by homann, 17 years ago

Need more info to fix this.

comment:8 by timlinux, 17 years ago

Milestone: Version 0.8.1Version 0.8.2

Moved to milestone 0.8.2 since we wont be fixing any further issues before the 0.8.1 release

comment:9 by homann, 17 years ago

Awaiting user input: set

comment:10 by homann, 17 years ago

Could you please see what projection 'ogrinfo -al <shape_file>.shp' reports?

comment:11 by neteler, 16 years ago

Cc: neteler added; neteler@… removed

comment:12 by leolami, 16 years ago

More info: I have a GRASS Location where the proj info file is:

name: Transverse Mercator proj: tmerc datum: rome40 towgs84: -104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 a: 6378388 es: 0.006722670022333322 lat_0: 0 lon_0: 9 k: 0.999600 x_0: 1500000 y_0: 0 no_defs: defined

I save this proj in custum projection of QGIS and I set it like default projection. The projection string is:

+proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl +units=m +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68

If I load a GRASS vector from a mapset in this Location and I look is properties I see taht its proj is: +proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl +units=m +no_defs For me this is an error!

If I try to export it I have a shape where the proj file is: PROJCS["Transverse Mercator",GEOGCS["international",DATUM["D_Monte_Mario",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTIONTransverse_Mercator,PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",9],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",1500000],PARAMETER["false_northing",0],UNIT["Meter",1]]

If I make ogr info -al I have this ouput:

INFO: Open of `/home/leo/prova/prova.shp'

using driver `ESRI Shapefile' successful.

Layer name: prova Geometry: Point Feature Count: 8 Extent: (1604054.308109, 4699810.841648) - (1741517.110000, 4858815.4 91363) Layer SRS WKT: PROJCS["Transverse Mercator",

GEOGCS["international",

DATUM["Monte_Mario",

SPHEROID["International_1924",6378388,297]],

PRIMEM["Greenwich",0], UNIT["Degree",0.017453292519943295]],

PROJECTIONTransverse_Mercator, PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",9], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",1500000], PARAMETER["false_northing",0], UNIT["Meter",1]]

cat: Real (11.0) nome: String (80.0) OGRFeature(prova):0

cat (Real) = 2 nome (String) = Lago di Sibolla POINT (1636817.088038051035255 4853827.627969310618937)

OGRFeature(prova):1

cat (Real) = 3 nome (String) = Padule di Fucecchio POINT (1645435.662079841829836 4849941.574495110660791)

OGRFeature(prova):2

cat (Real) = 4 nome (String) = Lame di S. Rossore POINT (1604054.308109045494348 4838571.107950324192643)

OGRFeature(prova):3

cat (Real) = 5 nome (String) = Laguna di Orbetello POINT (1680771.290981499478221 4699810.841648220084608)

OGRFeature(prova):4

cat (Real) = 6 nome (String) = Diaccia Botrona POINT (1657949.371251503005624 4737513.633872816339135)

OGRFeature(prova):5

cat (Real) = 7 nome (String) = Lago di Montepulciano POINT (1737917.001504842657596 4775048.474618563428521)

OGRFeature(prova):6

cat (Real) = 8

comment:14 by msieczka, 16 years ago

Cc: msieczka added
Platform: DebianUnix

Leonardo, Markus,

Aren't this ticket and #418 duplicates? Can we close either one?

comment:15 by pcav, 15 years ago

This is also related to #1079

comment:16 by rblazek, 15 years ago

Resolution: fixed
Status: assignedclosed

Seems to work correctly in revision #10899 (QGIS 1.2 unstable), PROJ.4 4.6.0, GRASS 7.0 (revision #36903). I have tested with 2 GRASS locations:

name: Transverse Mercator datum: rome40 datumparams: towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 proj: tmerc ellps: international a: 6378388.0000000000 es: 0.0067226700 f: 297.0000000000 lat_0: 0.0000000000 lon_0: 9.0 k_0: 0.9996000000 x_0: 1500000.0000000000

and

name: Lat/Lon proj: ll datum: wgs84 ellps: wgs84 no_defs: defined

and vector reprojected with v.proj. There is no shift if the vectors from those 2 locations are displayed in QGIS. To be sure that the datum shift is realy used and I am on the right zoom level I tried to remove 'datumparams' from the first location and a shift appeared.

Important is, that QgsCoordinateReferenceSystem::findMatchingProj correctly does not find srsid now which was the case of previous versions according to comments in https://trac.osgeo.org/qgis/ticket/418 and thus correct pure PROJ.4 string including +towgs is used. So it seems that OSRIsSame in PROJ.4 was fixed to use also towgs params.

Radim

comment:17 by rblazek, 15 years ago

OSRIsSame is not in PROJ.4, it calls OGRSpatialReference::IsSame from GDAL, but that loops through all params and last important fix I found is quite old http://trac.osgeo.org/gdal/changeset/2952

This bug was in fact fixed in this revision https://trac.osgeo.org/qgis/changeset/8263#file1 (SpatialRefSys::equals changed) where OSRIsSame was introduced.

Radim

comment:18 by rblazek, 15 years ago

Cc: rblazek added
Note: See TracTickets for help on using tickets.