Selecting all area features within a polygon

nickgoodliffnickgoodliff Global Mapper UserPosts: 45Trusted User
edited December 2013 in SDK
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

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2013
    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
  • nickgoodliffnickgoodliff Global Mapper User Posts: 45Trusted User
    edited December 2013
    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
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2013
    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
  • nickgoodliffnickgoodliff Global Mapper User Posts: 45Trusted User
    edited December 2013
    Ah brilliant - must have been looking at an old version!
  • nickgoodliffnickgoodliff Global Mapper User Posts: 45Trusted User
    edited December 2013
    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
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2013
    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/
  • nickgoodliffnickgoodliff Global Mapper User Posts: 45Trusted User
    edited December 2013
    Hi Mike,
    I don't suppose that feature could be added to v14 ... ?
    Thanks
    Nick
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2013
    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
  • nickgoodliffnickgoodliff Global Mapper User Posts: 45Trusted User
    edited December 2013
    No problem, I thought as much! I'll get my accounts team to check out our SDK agreement and contact sales.

    Thanks
    Nick
Sign In or Register to comment.