Projections
CanvasMap provides very flexible support for projections. This includes back projecting coordinates to get lat/lon values when a displayed data set is projected, projecting data on load, and dynamic projections where settings for the projection can be changed and then then data is projected on the fly.
CMProjector
CMProjector is the based class and is a subclass of CMBase.
Functions for subclasses to use
- GetGeographicClippingPolys(XMin,XMax,YMin,YMax,Pad) - return an array of clipping polys with information on if they are on the outside of the area or not. In other words, when we have a longitude of origin that is not 0 and we are rendering then tire earth, we need two clipping polygons, one for the area to the east of -180 and one for the area to the west of 180.
Functions for subclasses to override
Almost all subclasses will override the following functions:
- Initialize() - setup any internal variables before the projection functions are called
- ProjectToGeographic(Easting,Northing,Elevation) - project the specified coordinate back to geographic
- ProjectFromGeographic(Longitude,Latitude,Elevation) - project the specified coordinate to the projected system
The following functions will provide regions for filling and drawing the bounds of the valid projection area and a BoundingBox in projected space.
- GetRegionToFill() - Returns a region appropriate for filling as a background for the Geo, note that the region can include multiple areas
- GetRegionToDraw() - Returns a region appropraite for drawing the outline of the background for a Geo. Typically this is can be a set of polylines or polygons.
- GetProjectedBounds() - get the bounding box in projected coordinates (will always be continuous)
- GetClippingPolys() - Return the clipping polygons based on the current settings. Typically the subclass will call GetGeographicClippingPolys() to create mulitple polygons if needed and then return them from this function.
Types:
- None:
- Data is projected on server
- Fastest approach, should be used for large datasets
- Coordinates:
- Similar to None except projector is available to provide user with DD and DMS coordinates from projected data
- Projector is stored in the Geo. Mouse over events will trigger an update to the coordinates.
- On Load:
- Data is projected on load
- Data on server is in geographic
- The projector is set into the Layer(s) with SetProjector(). The layer will then project to the specified projection onload.
- Dynamic:
- Data is kept in Geographic
- Data set is projected on the fly
- Note that mouse events also have to be back projected to select features
- This allows for animating changes in projections
- Projector is set into the Geo
- Slowest appraach, should only be used with smaller datasets