Selecting all area features within a polygon
nickgoodliff
Global Mapper UserTrusted User
Hi Mike
Is there any way to do cropping of features (like the GM_SetExportCropAreas ) but without doing the export?
What I need is to be able to find all the features within a polygon to calculate their combined areas.
Cheers
Nick
PS. I'm using v14.2
Is there any way to do cropping of features (like the GM_SetExportCropAreas ) but without doing the export?
What I need is to be able to find all the features within a polygon to calculate their combined areas.
Cheers
Nick
PS. I'm using v14.2
Comments
-
Nick,
You can use the GM_FindFeaturesInArea function to identify features that are within another area feature.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Global Mapper -
Ok, thanks Mike. A little example code would be great...
I can't find 'GM_FindFeaturesInArea' definition anywhere, can you give me a little method to add to my GlobalMapperDLLWrapper.cs file?
Cheers
Nick -
Nick,
I show the function in the GlobalMapperDLLWrapper.cs file and it was added in SDK v14.1. Here is the declaration I have:
// Finds features that are inside the given area feature
[DllImport(DLLFileName, EntryPoint = "GM_FindFeaturesInArea")]
public static extern GM_Error_t32 GM_FindFeaturesInArea
(
IntPtr aLayerList, // IN: List of layers to search or NULL for all vector layers
UInt32 aLayerCount, // IN: Number of layers in list (0 for all)
GM_FindFlags_t32 aFindFlags, // IN: Flags controlling how the find is performed
ref GM_AreaFeature_t aAreaToSearch, // IN: Area feature to search (use GM_GetAreaFeature to get from loaded layer)
ref GM_Projection_t aAreaProj, // IN: Projection of coordinates in area feature (use GM_GetLayerInfo()->mNativeProj to get layer projection)
ref GM_FoundFeatureResults_t aResults, // OUT: Results of find operation (use GM_FreeFeatureResultList to free when done)
IntPtr aReserved // IN: Reserved for future use, must be NULL
);
Also if anything is ever missing in the wrapper you can find the original definition in the GlobalMapperInterface.h C-language declaration.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Global Mapper -
Ah brilliant - must have been looking at an old version!
-
Hi Mike
This is all working great now, but just have one more question - what are the inclusion rules of areas that are only partially in the aAreaToSearch? Is it possible to include all include areas even if they are not fully within the bounds? A bit like the setting GM_MiscOpt_KeepPixelIfAnyInCropPoly that I assume does this on exporting.
Cheers
Nick -
Nick,
I've updated the SDK so the GM_FindFeatureInArea function supports a new find flag (GM_FindFlags_PartialOk). If you pass that in now partially covered lines and areas should be returned. I have placed a new SDK build with this change at http://www.globalmapper.com/GlobalMapperSDK_v15_latest_beta.zip for you to try.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
http://www.bluemarblegeo.com/ -
Hi Mike,
I don't suppose that feature could be added to v14 ... ?
Thanks
Nick -
Nick,
Sorry we don't add new features to older SDK builds, but if you contact sales@bluemarblegeo.com it's possible your SDK agreement includes upgrades to v15, or at least you could get one for a small upgrade fee.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation -
No problem, I thought as much! I'll get my accounts team to check out our SDK agreement and contact sales.
Thanks
Nick
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