Load a custom layer on top of the existing one
mrkrishnan
Global Mapper User
hai guys,
i am developing one application using Global mapper SDK in MFC.
Now i have loaded the dt1 data as one layer. Now i want to define some custom area on to the map as a new layer. Is it possible?
i.e i want to create a own shape file and load as another layer.
i want to know how to create a shape file.
Thanks in advance
Regards
Radhakrishnan
i am developing one application using Global mapper SDK in MFC.
Now i have loaded the dt1 data as one layer. Now i want to define some custom area on to the map as a new layer. Is it possible?
i.e i want to create a own shape file and load as another layer.
i want to know how to create a shape file.
Thanks in advance
Regards
Radhakrishnan
Comments
-
Yes, you can use the GM_CreateCustomVectorLayer function to create a new vector layer, then use the GM_AddAreaToVectorLayer, GM_AddLineToVectorLayer, or GM_AddPointToVectorLayer functions to add new features to those layers. If you want to create a Shapefile, you can then use the GM_ExportVector function to export that layer to a new Shapefile.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Thank you for your support.
Now i want to know, is there any API to display the grid with kilometer like lat and long/global projection with some reference Lat/Long?
Regards
Radhakrishnan -
Use the GM_DrawGridLines function to draw grid lines on your map.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
i did that already. but that is giving the grid in the format lat/long and projection format, but i want that with every 10 kilometer space.
i have one more doubt, i wanted to load a dt1 data in a full view in MFC and specified the full area also, but it loaded in some portion only. how can i load that in full size.
Regards
Radhakrisnan -
To get a grid with a 10 kilometer spacing, you need to set your projection to a projected system (like UTM, or anything else with linear units), then provide a grid spacing equal to 10 km in the units of the current projection (like 10000.0 if the units are GM_PRJ_UNIT_METERS).
Whenever you load a file, like a DT1 file, the entire file will be loaded. You can however specify for just a portion to draw by using the rectangle bounds parameter to the draw function.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
As you replied the entire file loaded properly, but i specified the full window size as drawing area, but it is loading in some portion only instead of full window size. Because of this issue when i tried to draw the grid that also drawn in that portion only.
i have just added some portion of code for your reference
void CGlobalMapperTestAppView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
RECT theMapWndRect;
/*GetSafeOwner()->*/GetClientRect( &theMapWndRect );
// ScreenToClient( &theMapWndRect );
mMapWindow.SetDrawWindow( GetSafeHwnd());
mMapWindow.SetDrawWindowRect( theMapWndRect );
}
i call this portion when user load a new layer
void CGlobalMapperTestAppView::OnLoadNewlayer()
{
if ( GM_Error_None == mMapWindow.LoadLayer() )
{
// Refill our layer list
GM_SetBackgroundColor(RGB(255, 255, 0)) ;
FillLayerList();
mMapWindow.ZoomIn(2.0) ;
}
}
regards
Radhakrishnan -
It looks like in your OnLoadNewlayer function that for the first file that is loaded you will zoom in by a factor of 2 on the center of that data as the initial load view will be to all loaded data. For subsequent loads where something is already loaded, you will just zoom in by a factor of 2.0 on your current view rather than a factor of 2 on the bounds of all loaded data. If you want to always zoom in on all loaded data, add a call to mMapWindow.ZoomToAllLayers() after your mMapWindow.LoadLayer() call.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Because of the full area loading problem i just did that zoom to make that in full view. Just i have attached the output for your reference.
-
Is there any further issue or have you got everything figured out?
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
in that figure it shows that is loaded in some portion only, but i want that is to be loaded in full window size.
Thanks and Regards
Radhakrishnan -
You control what the ground coordinate are of your view window when you draw. Just modify the draw rectangle that you pass into the draw function (or use GM_MapWindow::SetCurrentViewRect) to draw just what you want to draw.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Thanks for your patient mike, but still i couldn't get that in full view after used SetCurrentViewRect function also.
-
Maybe I'm misunderstanding what you want to do, but I think what you may be seeing is because by default the draw maintains the aspect ratio of the data bounding rectangle that you pass in to the GM_DrawLayerList function in relationship to the aspect ratio of the pixel area being drawn. So your draw rectangle will be grown vertically or horizontally until the aspect ratio matches the pixel ratio to avoid stretching.
If you really the exact rectangle that you provide to be drawn and don't care about stretching, pass in the GM_DrawFlags_DontMaintainAspectRatio draw flag to the GM_DrawLayerList function.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Thanks mike i have got it.
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website