= !MapGuide RFC 6 - Overriding Coordinate Systems in Feature Sources =
This page contains a 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||February 6, 2007||
||Last Modified||Tony Fang [[Timestamp]]||
||Author||Tony Fang||
||RFC Status||draft||
||Implementation Status||pending||
||Proposed Milestone||1.2||
||Assigned PSC guide(s)||(when determined)||
||'''Voting History'''||(vote date)||
||+1|| ||
||+0|| ||
||-0|| ||
||-1|| ||
== Overview ==
In the feature source, there is an optional tag called !SupplementalSpatialContextInfo. This can contain a !SpatialContextType defining a coordinate system override. If an entry exists for a given Spatial Context, then the specified coordinate system override will be used. The coordinate system override will be given preference over the coordinate system defined in the data.
Previously, the !SupplementalSpatialContextInfo was used only for data containing spatial contexts with undefined coordinate systems. The !SupplementalSpatialContextInfo would allow a coordinate system to be specified for a given spatial context. The !SupplementalSpatialContextInfo can now be used to override coordinate systems for all spatial contexts in a feature source -- regardless of whether it contains a coordinate system or not.
== Motivation ==
If a feature source geometry contains an incorrect coordinate system or does not have a coordinate system defined, this provides a convenient way to change the coordinate system without having to change the data of the feature source.
!MapGuide can only deal with spatial data with a specified coordinate system. Changing the behaviour to allow the specification of a coordinate system override allows you to use data that you may not otherwise.
== Proposed Solution ==
The schema !FeatureSource-1.0.0.xsd does not change. !SupplementalSpatialContextInfo already exists in the schema. The schema documentation will be updated to reflect the new behaviour in the server.
{{{
Additional information for a spatial context when the coordinate system is overridden.
}}}
When the server returns the data for a given feature source. it will check for entries in the !SupplementalSpatialContextInfo. If there is a spatial context containing a coordinate system override, then that is the coordinate system used for the data.
Here is a feature source containing a coordinate system override:
{{{
OSGeo.SDF
File
%MG_DATA_FILE_PATH%CENTLINES.sdf
ReadOnly
TRUE
LL84
PROJCS["CANA83-3TM114",GEOGCS["CANA83-3TM114",DATUM["NAD 83",SPHEROID["GRS 80",6378137,298.25722210089],TOWGS84[0,0,0,0,0,0,0]],PRIMEM["Greenwich",0],UNIT["Degrees", 0.0174532925199433]],PROJECTION["Transverse Mercator"],PARAMETER["central_meridian", -114],PARAMETER["latitude_of_origin", 0],PARAMETER["scale_factor", 0.9999],PARAMETER["false_easting", 0],PARAMETER["false_northing", 0],UNIT["Meter", 1]]
}}}
The data in this feature source (CENTLINES.sdf) contains a spatial context called LL84. The coordinate system defined for that spatial context is:
{{{
GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]
}}}
But the coordinate system has been overridden with:
{{{
PROJCS["CANA83-3TM114",GEOGCS["CANA83-3TM114",DATUM["NAD 83",SPHEROID["GRS 80",6378137,298.25722210089],TOWGS84[0,0,0,0,0,0,0]],PRIMEM["Greenwich",0],UNIT["Degrees", 0.0174532925199433]],PROJECTION["Transverse Mercator"],PARAMETER["central_meridian", -114],PARAMETER["latitude_of_origin", 0],PARAMETER["scale_factor", 0.9999],PARAMETER["false_easting", 0],PARAMETER["false_northing", 0],UNIT["Meter", 1]]
}}}
=== Web Studio ===
The feature source editor in Web Studio will be updated to enable the selection of a coordinate system for a feature source.
== Implications ==
If the !SupplementalSpatialContextInfo contains a spatial context with a coordinate system, then that is the coordinate system which will be used on the data. It will override any coordinate system contained in the data. This is the behaviour that is changing.
If the feature source does not contain a spatial context with a coordinate system, then the coordinate system contained in the data will be used. This behaviour is not changing.
== Test Plan ==
Add unit tests to verify behaviour of the coordinate system overrides.
== Funding/Resources ==
Autodesk to supply.
The Web Studio work will be done by DM Solutions Group.