New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QGIS fails to read undefined projection from user datum in shape.prj file #10477
Comments
Author Name: Martin Dobias (@wonder-sk) This is not that trivial as it looked like. Let's explain what happens when QGIS tries to match a projection with its spatial reference database:
In your case first two options don't find equivalent in database, but third does and tells QGIS that it's the same projection as "+proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl +units=m +no_defs". The problem is that OGR's [IsSame] function is not robust enough to make a difference between this and the specified ones. (See ogrspatialreference.cpp in OGR if interested) To get it working correctly you have to add it as a custom projection (menu Settings -> Custom projection). If [IsSame] worked correctly, it wouldn't recognize any projection and you would be asked to select one from database or a default one would be used (depending on settings). Thus I'm closing this ticket as it seems that we're unable to fix it. ... probably this should be reported to OGR project...?
|
Author Name: neteler-itc-it - (neteler-itc-it -) You said that "The problem is that OGR's [IsSame] function is not robust enough to make a difference between this and the specified ones." In fact, there is close to no difference besides the towgs84 part which would "just" be needed to be transferred to the projection found by QGIS in it's DB. I don't know if failing on that completely and not recognize any projection Best, |
Author Name: Martin Dobias (@wonder-sk) Well, it seems that towgs84 parameter is quite important. Maybe in this case there's really small difference. But when looking to the QGIS's database of projections, there are (many) projections that specify towgs84 parameter, so I guess that it might be quite important - removing it temporarily would be incorrect. A solution might be to use original proj string even if another projection has been declared as the same. But I don't know if this won't break other things or create some inconsistencies. |
Author Name: neteler-itc-it - (neteler-itc-it -) Hi, I think we have a missunderstanding here. I meant to say In case that a towgs84 parameter is already present in the QGIS SRS DB, it should use the user provided one (maybe pop up a notice that it was doing so). Hope that's clarified now what I tried to say. Markus |
Author Name: Martin Dobias (@wonder-sk) Replying to [comment:5 neteler@itc.it]:
I understand your idea. But the problem is in the way how QGIS copes with spatial references. Once proj4 string is read, QGIS searches for a SRS ID in SRS database. SRS ID is unique for every projection. Thus even if two projection are nearly same (e.g. with or without towgs84) they must have different SRS ID to enable QGIS understand the difference. That's why taking out towgs84 temporiraly makes no sense - another SRS ID would be chosen instead. Rescue from this situation is to add custom projection. Once added, your projection has its own SRS ID and will be detected correctly. Martin |
Author Name: neteler-itc-it - (neteler-itc-it -) Hi Martin, I am again falling into this trap: Warning: [[QgsSpatialRefSys]]::getRecord failed : select * from tbl_srs where parameters='+proj=utm +zone=32 +ellps=intl +towgs84=-87.000,-98.000,-121.000 +units=m +no_defs' Displaying these two maps with on-the-fly projection activated, they are shifted by around 100m: PROJCS[[UTM Zone 32 Northern Hemisphere"GEOGCS["international"DATUM["D_European_1950"SPHEROID["International_1924"6378388297]TOWGS84[-87000-98000-121000]]PRIMEM["Greenwich"0]UNIT["Degree"0017453292519943295]]PROJECTION["Transverse_Mercator"]PARAMETER["latitude_of_origin"0]PARAMETER["central_meridian"9]PARAMETER["scale_factor"09996]PARAMETER["false_easting"500000]PARAMETER["false_northing"0]UNIT["Meter]] PROJCS[[Transverse Mercator"GEOGCS["international"DATUM["D_Monte_Mario"SPHEROID["international"6378388297]]PRIMEM["Greenwich"0]UNIT["Degree"0017453292519943295]]PROJECTION["Transverse_Mercator"]PARAMETER["latitude_of_origin"0]PARAMETER["central_meridian"9]PARAMETER["scale_factor"09996]PARAMETER["false_easting"1500000]PARAMETER["false_northing"0]UNIT["Meter]] In my opinion at least a visible warning should pop up that reading the .proj file failed. thanks, |
Author Name: Redmine Admin (Redmine Admin) Hi Please consider Markus request. QGIS silent failure to assign a datum shift is really bad. If, instead, a warning would pop up with info that datum was not recognized and the user is asked to define the CRS manually himself to workaround it, this would be a great help. I just had this issue too, working with archival topo maps of Germany, for which the 584.8,67.0,400.3,0.105,0.013,-2.378,10.29 datum shift from Bessel 1841 to WGS84 was not recognized by QGIS and it silently fell to no datum shift at all. This has resulted in an over 250m error. For an unexperienced user this might mean real trouble. Maciek
|
Author Name: Magnus Homann (@homann) This can't be done unless we re-do the entire projections system, earliest at 0.9. |
Author Name: Markus Neteler (Markus Neteler) In current SVN trunk i(pre 1.0.0) t continues to fail:
It works when I manually remove the TOWGS84 string from the WKT (.prj) file. Suggestion: Ignore the TOWGS84 string when matching the projection, and issue a warning (not a complete failure) that TOWGS84 differs. Note that most (in theory all) Italian QGIS users have this problem. Likewise for other countries. thanks, |
Author Name: Magnus Homann (@homann) Is this error still present? Another towgs bug has been fixed, I believe.
|
Author Name: Magnus Homann (@homann) Talked to timlinux, and the idea with have is if the specfied projection does not have an exact match (including +towgs84= )in the database of projections, it will ask the user if he/she wants to create a custom projection. Do you think that will solve the issue? This wont happen until 1.1.0 I'm afraid, needs GUI changes and has potential for large changes of projection code needed.
|
Author Name: Markus Neteler (Markus Neteler) Replying to [comment:14 homann]:
I think so. But:
Understood. But as suggested above: Please issue at least a warning that TOWGS84 differs (if not happening already). Markus |
Author Name: Magnus Homann (@homann) I'm sorry, but the warning is still a GUI change. That towgs differs is just a special case of the fact that the projections differs. As soons as GUI freeze is over i'll try to fix this. |
Author Name: Paolo Cavallini (@pcav) There is a problem in PROJ4: there are several datum for EPSG 3003 (and |
Author Name: Magnus Homann (@homann) Automatic addition of a custom CRS for unknown to QGIS - but valid - CRS:es from e.g WKT in 93d5bd2 (SVN r11367). If there are any different problems from Italian qgissers, please open a new ticket.
|
Author Name: neteler-itc-it - (neteler-itc-it -)
Original Redmine Issue: 418
Redmine category:projection_support
Assignee: Magnus Homann
Hi,
when opening Italian maps, we usually have to define a "user" datum since PROJ4 doesn't contain the definitions (as there are 3 datums for the same EPSC code in Italy, depending on where you are). The [[QgsSpatialRefSys]] detection fails, however:
qgis ammprvBL.shp
Warning: [[QgsSpatialRefSys]]::getRecord failed : select * from tbl_srs where parameters='+proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0 +ellps=intl +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +units=m +no_defs'
If I take out the towgs84 part from the .prj file, it works.
It would be great to make QGIS tolerant for user defined towgs84 parameters which is rather the standard in Europe (many countries, many datums).
Proposal as general solution:
Maybe the towgs84 part could be temporarily taken out for the SQL search and re-added after the getRecord request was done.
Best,
Markus
PS: Attached the .prj file content
The text was updated successfully, but these errors were encountered: