= !MapGuide RFC 55 - Switch from PROJ4 to CS-Map coordinate system library = This page contains an change request (RFC) for the !MapGuide Open Source project. More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date||August 07, 2008|| ||Last Modified||Bruce Dechant [[Timestamp]]|| ||Author||Hugues Wisniewski|| ||RFC Status||adopted|| ||Implementation Status||completed|| ||Proposed Milestone||2.1|| ||Assigned PSC guide(s)||Bruce Dechant|| ||'''Voting History'''|| || ||+1||Andy, Bruce, Haris, Jason, Paul, Tom || ||+0|| || ||-0|| || ||-1|| || ||no vote|| Bob || == Overview == For the coordinate system work, !MapGuide uses the PROJ4 library which is wrapped into the !MgGeometry.dll binary module. The coordinate system functionality is exposed through all the API interfaces prefixed with !MgCoodinateSystem This proposal aims at replacing the PROJ4 implementation with the CS-Map implementation. CS-Map was recently open sourced and posted on at:[[BR]] http://svn.osgeo.org/metacrs/csmap/ == Motivation == The CS-Map code has a broader range of functionality than what PROJ4 can offer.[[BR]] [[BR]] CS-Map can address things that are not well addressed by PROJ4 like:[[BR]] [[BR]] - vertical datum shifting[[BR]] - WKT transformations in multiple flavors like Oracle[[BR]] - greater coverage in terms of coordinate system definitions, right now more than 4000 systems, roughly 700 datums and 100 ellipsoids[[BR]] - CS-Map can provide an implementation to all the !MgCoordinateSystem API methods that currently throw !MgNotImplementedException[[BR]] == Proposed Solution == The current !MgCoordinateSystem API implementation code is a wrapper around PROJ4[[BR]] This implementation code is located here: [[BR]] http://svn.osgeo.org/mapguide/trunk/MgDev/Common/CoordinateSystem/ [[BR]] The new API implementation would wrap the CS-Map code hosted at:[[BR]] http://svn.osgeo.org/metacrs/csmap/trunk/CsMapDev/ [[BR]] [[BR]] This API is part of the module !MgGeometry.dll generated from the project:[[BR]] http://svn.osgeo.org/mapguide/trunk/MgDev/Common/Geometry/Geometry.vcproj [[BR]] [[BR]] This project is used in the solutions:[[BR]] [[BR]] http://svn.osgeo.org/mapguide/trunk/MgDev/Server/Server.sln [[BR]] http://svn.osgeo.org/mapguide/trunk/MgDev/Web/src/WebTier.sln [[BR]] [[BR]] The current PROJ4 implementation would not be supported anymore. Only CS-Map would remain in the place where the PROJ4 currently resides:[[BR]] http://svn.osgeo.org/mapguide/trunk/MgDev/Common/CoordinateSystem/ [[BR]] == Implications == PROJ4 would not be supported anymore.[[BR]] The coordinate system definitions will come from the CS-Map coordinate system dictionaries.[[BR]] All the !MgCoordinateSystem API methods that currently throw !MgNotImplementedException would have a fully functional implementation.[[BR]] The build process documentation will have to be updated to explain how to get and build CS-Map and then build !MapGuide using CS-Map instead of PROJ4.[[BR]] [[BR]] Concerning the possible risk that users would see differences from one application to the next when moving from PROJ4 to CS-Map, this may indeed impact !MapGuide because of the differences between Proj4 and CSMap. Ie: supported projections, the way transformations are calculated, or slightly different coefficient precision in the coordinate system definitions, etc...[[BR]] Any of the well known and highly used systems in CS-Map is unit tested with a list of test points that should be transformed to an expected target point within a certain tolerance. This test points in this list typically come from official sources. We can expect slightly different results between the two libraries depending on the reasons listed above but if there is a large difference between the two products, and we have valid test points for a given transformation to test what is expected, the resulting defect we would be facing in that case in the algorithm or in the system definition will have to be fixed.[[BR]] [[BR]] Some coordinate systems may not work with the new CSMAP. Though the number should be very low. Resources would need to be updated to use the CS-MAP equivalent CS if there is failing CS.[[BR]] If a definition is missing, the creation of a custom system is possible via the fully implemented !MgCoodinateSystem API that will be provided.[[BR]] If a projection or datum technique is missing, a source code update would be needed inside CS-Map. This would be of course possible after approval of the corresponding RFC that would need to be written against that OSGEO project. == Test Plan == CS-Map has its own standalone unit tests so it can be tested separately.[[BR]] The existing unit !MapGuide unit tests would remain the same.[[BR]] More can be added, especially for the new functionality that CS-Map provides, like the WKT conversions.[[BR]] == Funding/Resources == Provided by Autodesk.[[BR]] == Additional Notes == The code is ready to be distributed.[[BR]] If this request is accepted, the implementation would be trivial as it has already been intensively tested and is fully functional.[[BR]] == Mapping coordinate systems from PROJ4 to CS-Map == [wiki:PROJ4toCS-MAP PROJ4 to CS-Map] == Addendum - New datum transformation technique in !CsMap will need to be exposed in the API == There is a new ticket logged against Cs-Map that fixes the 3Parameter conversion technique by introducing a new technique named "Geocentric" http://trac.osgeo.org/csmap/ticket/4 When this defect is fixed, the switch to the Cs-Map implementation will need to have the !MgCoordinateSystem API expose it via a new entry inside the !MgCoordinateSystemGeodeticTransformationMethod enum That is the only change in the API that is expected from the move to !CsMap