How to crop an area feature?

mg.srikanth
Global Mapper User
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.
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
-
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 -
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. -
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
Categories
- 12.5K All Categories
- 5.5K Features Discussion
- 314 Downloading Imagery
- 1.3K Elevation Data
- 377 Georeferencing Imagery Discussion
- 611 GM Script Language
- 50 User Scripts
- 112 GPS Features
- 397 Projection Questions
- 803 Raster Data
- 1.3K Vector Data
- 6.5K Support
- 161 Announcement and News
- 893 Bug Report
- 557 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 542 Other Discussion
- 128 GIS Data Sources
- 26 Global Mapper Showcase
- 229 How I use Global Mapper
- 104 Global Mapper Forum Website