shift Layers a Fixed Distance ???
Comments
-
You can use the GM_RepositionLayer function to provide a new set of control points with the shifted location. For vector data you only need 2 control points, say with input ("pixel") locations of 0,0 and 1,1 and the output (ground) locations of the shift added to that. So if you wanted to go 3 meters east and 2 meters south, the output points would be (-3,2) [note you have to negate the shift] and (-2,3). For raster layers just get the control point list from the GM_GetLayerInfo call, adjust each mGroundX and mGroundY value by the shift amount, then call GM_RepositionLayer with the new control points list.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com -
Thanks,
Mike One more question?
How do I use (in shp or dxf vector) -
vector case :
GM_RepositionLayer how to use ???
Please sample code -
Try something like the following to shift a layer handle (theLayerHandle in code below) 3 units to the east and 2 units to the south:
GM_GroundControlPoint_t theGCPList[2];
memset( theGCPList, 0, sizeof theGCPList );
double theShiftX = 3.0;
double theShiftY = -2.0;
theGCPList[0].mPixelX = 0;
theGCPList[0].mPixelY = 0;
theGCPList[0].mGroundX = theGCPList[0].mPixelX - theShiftX;
theGCPList[0].mGroundY = theGCPList[0].mPixelY - theShiftY;
theGCPList[1].mPixelX = 1;
theGCPList[1].mPixelY = 1;
theGCPList[1].mGroundX = theGCPList[1].mPixelX - theShiftX;
theGCPList[1].mGroundY = theGCPList[1].mPixelY - theShiftY;
GM_RepositionLayer( theLayerHandle, theGCPList, 2, NULL );
Note I just did this off the top of my head and haven't compiled or tested it, but you should get the idea.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 636 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 826 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 913 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website