How to crop an area feature?

mg.srikanthmg.srikanth Global Mapper UserPosts: 27
edited November 2012 in SDK
Hello,

I am using SDK version13 for my project development, one of my requirement is to draw an area feature avoiding the canals, ponds or lake feature present in the DGN/shp file, i.e., if i draw an area (polygon) on the map using mouse clicks or providing lat-lon information of the vertices then my application should crop/clip the area such that the perimeter of the polygon should not fall inside the undeployable features (canals/ponds/lakes/river/etc..) available on the map.
How do i achieve it using GM SDK?

Plz Help.

Srikanth.

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2012
    Srikanth,

    Would those features tend to be inside the areas that you draw? If so you could just add their boundaries, or perhaps the boundary of a buffer if a line or point features, as a hole in the area feature to basically remove it from the area.

    Other than that there isn't yet a generic crop function in the SDK other than cropping on export.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • mg.srikanthmg.srikanth Global Mapper User Posts: 27
    edited November 2012
    Hi Mike,

    Those features may or may not be inside the area drawn, they may start from inside the drawn area and end somewhere else, in which case if I draw a rectangle I should be able to crop and draw it on the map like how a piece of bread eaten by rat at one corner looks.
    I thought that i would do it similar to view shed analysis which will not draw the total circle, which crops the invisible area and draws only visible (or invisible) part.
    If there is no generic crop function then how do I crop the area and export it and reload the cropped layer using SDK??

    Thanks,

    Srikanth.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2012
    Srikanth,

    This could be a bit tricky in the v13 SDK as the crop is intersection only with no holes. For the export, use GM_SetExportCropAreas with the list of areas to crop to. If you actually wanted to crop away some areas you would actually need to create a single large outer area big enough to contain everything that you want to crop to and also what is being cropped (just make it huge) then add all of the features that you want to remove as holes in that GM_AreaFeature_t. However in v13 the holes in the crop area are ignored when cropping other areas to it, but they should be used in the latest v14 SDK build from http://www.globalmapper.com/GlobalMapperSDK_v14_latest_beta.zip . Once the crop areas are set you would use GM_ExportVector to export just the layer with the area(s) that you want to crop. Then close that layer and load back in the file that you just exported.

    We also have plans to add a more functional GM_CropFeatures function that would crop any type of features without the intermediate export and also support operations other than intersection, like subtraction. If you upgrade your SDK to v14 and find that the export crop method isn't suitable then I can look at adding the crop functionality sooner rather than later.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
Sign In or Register to comment.