gvSIG bugs #2632
Loss of precision parsing CRS parameters
| Status: | Closed | % Done: | 0% | |
|---|---|---|---|---|
| Priority: | Normal | Spent time: | - | |
| Assignee: | ||||
| Category: | CRS | |||
| Target version: | 2.1.0-2248-testing | |||
| Severity: | Minor | Add-on version: | ||
| gvSIG version: | 2.1.0 | Add-on build: | ||
| gvSIG build: | 2232 | Add-on resolve version: | ||
| Operative System: | Add-on resolve build: | |||
| Keywords: | crs, precision, wkt, proj4 | Proyecto: | ||
| Has patch: | Yes | Hito: | ||
| Add-on name: | Unknown |
Description
It happens a loss of precision parsing some CRS parameters, such as semi_minor, central_meridian and latitude_of_origin which affects the WKT and Proj.4 representation in the CRS information window (see screenshot in attachment) and elsewhere.
For instance, open the Jython console and type:
>>> from org.gvsig.fmap.crs import CRSFactory
>>> proj = CRSFactory.getCRS('EPSG:23032')
>>> wkt = proj.getWKT()
>>> print wkt
PROJCS["ED50 / UTM zone 32N", GEOGCS["ED50", DATUM["European Datum 1950", SPHEROID["International 1924", 6378388.0, 297.0]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 8.999999999999991], PARAMETER["scale_factor", 0.9996], PARAMETER["false_easting", 500000.0], PARAMETER["false_northing", 0.0], UNIT["metre", 1.0], AUTHORITY["EPSG", 23032]]
>>> proj4 = proj.getProj4String()
>>> print proj4
+proj=tmerc +lat_0=0.0 +lon_0=8.999999999999991 +k=0.9996 +x_0=500000.0 +y_0=0.0 +ellps=intl
+lon_0 should be equal to 9 instead of 8.999999999999991, so this parameter (and all the numeric ones) should be parsed as String and not as Double.
Associated revisions
Loss of precision parsing CRS parameters, refs #2632
History
#1
Updated by Antonio Falciano almost 12 years ago
- File 23032_loss_of_precision.png added
#2
Updated by Antonio Falciano over 11 years ago
- File round_proj_parameters.patch
added
Has patch: Yes
There were some rounding problems with Math.PI and Math.toDegrees. This is the output of the same code after the application of the patch in attachment:
>>> from org.gvsig.fmap.crs import CRSFactory
>>> proj = CRSFactory.getCRS('EPSG:23032')
>>> wkt = proj.getWKT()
>>> print wkt
PROJCS["ED50 / UTM zone 32N", GEOGCS["ED50", DATUM["European Datum 1950", SPHEROID["International 1924", 6378388.0, 297.0]],
PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295]], PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 9.0], PARAMETER["scale_factor", 0.9996],
PARAMETER["false_easting", 500000.0], PARAMETER["false_northing", 0.0], UNIT["metre", 1.0], AUTHORITY["EPSG", 23032]]
>>> proj4 = proj.getProj4String()
>>> print proj4
+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=500000 +y_0=0 +ellps=intl
So both WKT and Proj4 strings take benefit from this. The same Proj4 strings is shown in the CRS information window correctly.
#3
Updated by Joaquín del Cerro Murciano over 11 years ago
- Has patch set to Yes
#4
Updated by Álvaro Anguix over 11 years ago
- Assignee set to Joaquín del Cerro Murciano
#5
Updated by Antonio Falciano over 11 years ago
- Target version set to 2.1.0-2259-rc3
#6
Updated by Joaquín del Cerro Murciano over 11 years ago
- Status changed from New to Fixed
#7
Updated by Joaquín del Cerro Murciano over 11 years ago
- Target version changed from 2.1.0-2259-rc3 to 2.1.0-2248-testing
#8
Updated by Antonio Falciano over 11 years ago
- Status changed from Fixed to Closed