how to load multiple layers?

mappersmappers Global Mapper UserPosts: 2
edited August 2008 in SDK
Hi,I am a newbie on global mappers.

I am trying to develop a GIS application with this SDK in C# and i have the following questions.
1.How to load multiple layers by C#.I am considering the following solution
1/load a layer to the application by LoadLayer funtion provided by the SDK.
2/loaer another layer to the first layer and so on.

Can you provide a sample code if possible?

2.How to search a street with this SDK?Is there any function provided for this function in the SDK?Or i have to use code to search the street drawn in the application and made it red manually?

3.How to draw our own map?Do i need to develop a drawing application to draw the map and then export it?

4.How to save the map to be in mid/mif format?

Many Thanks

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2008
    I'm not a C# programmer, but I can provide some help.

    I would first suggest looking at the small (user-provided) sample application for the SDK in C# that demonstrates some of the functionality of the SDK. This is available on the Developers page at GLOBAL MAPPER.

    This will demonstrate calling GM_LoadLayer to load a layer and add it to a list of loaded layers and also for drawing the loaded data to a window in your application. There is also a GM_LoadLayerList function that really should be used as it supports loading a file that may result in several layers being loaded (like from a .zip file). The implementation of this is a bit harder as it requires several manual marshalling operations, but it's not rocket science. The VB.NET example on the Developers page at GLOBAL MAPPER should give you an idea of how to do something similar in C#.

    You can use the GM_FindNearestFeatures function to search for features near a given location, or you could simply iterate through the loaded features in each layer looking for a match on some criteria (like name or attribute value) using the GM_GetLayerInfo function to get the number of features in the layer (i.e. mNumAreas, mNumLines, and mNumPoints) and then calling functions like GM_GetLineFeature to get information about that line features to search on.

    You can use the GM_ExportVector function to export any loaded vector data to several formats, including MID/MIF.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • mappersmappers Global Mapper User Posts: 2
    edited August 2008
    Thanks Mike,

    But i still have the question,How to load another layer to the existing layer loaded before and show them together as you did in global mapper V9?

    in the c# sample,i saw that it draws the loaded data as a layer to the windows application,but i didnt find how to display multiple layers at the same time in the windows application.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2008
    You don't have to do anything special. Just call GM_LoadLayer to load another layer. By default the GM_DrawLayerList function will draw all loaded layers together unless you specifically provide a list of layers to draw. Layers stay loaded until you call GM_CloseLayer on them.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
Sign In or Register to comment.