Working with Projected Data
Take a look at the Humboldt Bay Example that is in UTM Zone 10 North. You will see that the data isn UTM but there is no UTM projector in the file. This is because you only have to make sure that all your data is in the same spatial reference and CanvasMap will display it together. If you want to display coodinates for the mouse cursor in geographic, then you will need to specify a projector.
The major change with projected data is the size of the coordinate values. We recommend the following:
- Find the center of your data in projected map units. For UTM around Humboldt Bay, these are values of about 440,000meters for the eastings and 4,400,000 meters for the northings.
- Set the center of your data as X and Y variables in your file.
- Project your data and save it in appropriate file types (e.g. "js").
- Load your data into layers in an OnLoad() function as you would for any CanvasMap.
- Add the code below after you start your map to have the view placed directly over your data.
- If you cannot see your data it is because you are probably either too close to it or too far away. Change the Z value until you can see your data.
- Finally, add and subtract distances to your X and Y values in the LookAt() function until you have a pleasing view of your data.
TheView.SetSetting("Item","PositionOffset",[X,Y,200000]); //(x,y,z) left and right(x), up and down(z), in and out but always looking at same spot(y) TheView.SetSetting("CM3View","LookAt",[X,Y,0]); // look at the origin
In the examle, we found that subtracting 120000 meters from the Y coordinate gave us a nice southernly view of the coast outside Humboldt Bay.