OpenLayers freehanddraw forEachFeatureInExtent returns features not in shapeHow to detect touch events on...

Shifting between bemols (flats) and diesis (sharps)in the key signature

finite abelian groups tensor product.

What are some noteworthy "mic-drop" moments in math?

Declaring and defining template, and specialising them

Signed and unsigned numbers

Find longest word in a string: are any of these algorithms good?

Error during using callback start_page_number in lualatex

How can I get players to stop ignoring or overlooking the plot hooks I'm giving them?

What was the Kree's motivation in Captain Marvel?

Does the nature of the Apocalypse in The Umbrella Academy change from the first to the last episode?

Can one live in the U.S. and not use a credit card?

Counting all the hearts

Why does Captain Marvel assume the people on this planet know this?

Should I tell my boss the work he did was worthless

Child Theme Path Being Ignored With wp_enqueue_scripts

How can The Temple of Elementary Evil reliably protect itself against kinetic bombardment?

PTIJ: wiping amalek’s memory?

An alternative proof of an application of Hahn-Banach

When a wind turbine does not produce enough electricity how does the power company compensate for the loss?

Why was Goose renamed from Chewie for the Captain Marvel film?

Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?

What are the practical Opportunty Attack values for a bugbear, holding a reach weapon, with Polearm Mastery?

meaning and function of 幸 in "则幸分我一杯羹"

Do items de-spawn in Diablo?



OpenLayers freehanddraw forEachFeatureInExtent returns features not in shape


How to detect touch events on mobile browsers with OpenLayers 3?Buffering multiple features with Geoserver WPSOpenLayers 3: getting rid of 'blue dot' selection iconRendering freehand drawn geometry from geojson on map with OpenLayers?How to merge two (or more) features in OpenLayers?OL 4.2 WMS getGetFeatureInfoUrl producing incorrect URLUse map.on Click for different events (edit Drawing, Popup) on Openlayers maplayer get extent returns null openlayers 4OpenLayers 4 getGetFeatureInfoUrl and HitTolleranceopenlayers 3 ol.source.ImageWMS.getGetFeatureInfoUrl returns bad XY













1















I am not a newbie.
I am trying to get the features(icons) found inside a closed freehand line.
The approach I am taking is to take the extent returned from the drawing and
use it to get the features(icons) inside the drawing. This works. It includes some extra features(icons). Is there a better approach to finding featues(icons) inside the freehand drawing that is more accurate? If not I have had some success using the following:



The extent returned with draw.on('drawend', function (event) {
is used to get features in closed line drawn on map.



vectorSource.forEachFeatureInExtent will have features not inside drawing



var geomA = event.feature.getGeometry();

var bhpoints = geomA.flatCoordinates;


I use these flatCoordinates(xy) to compare to each feature to get a more
accurate decision whether the feature is in or outside of the closed line.



This works but will miss once and a while.



To restate my goal:



I want to find the features(icons) inside of a freehand drawing and the
obvious solution with extents needs better accuracy.










share|improve this question
















bumped to the homepage by Community 27 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    I am not a newbie.
    I am trying to get the features(icons) found inside a closed freehand line.
    The approach I am taking is to take the extent returned from the drawing and
    use it to get the features(icons) inside the drawing. This works. It includes some extra features(icons). Is there a better approach to finding featues(icons) inside the freehand drawing that is more accurate? If not I have had some success using the following:



    The extent returned with draw.on('drawend', function (event) {
    is used to get features in closed line drawn on map.



    vectorSource.forEachFeatureInExtent will have features not inside drawing



    var geomA = event.feature.getGeometry();

    var bhpoints = geomA.flatCoordinates;


    I use these flatCoordinates(xy) to compare to each feature to get a more
    accurate decision whether the feature is in or outside of the closed line.



    This works but will miss once and a while.



    To restate my goal:



    I want to find the features(icons) inside of a freehand drawing and the
    obvious solution with extents needs better accuracy.










    share|improve this question
















    bumped to the homepage by Community 27 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I am not a newbie.
      I am trying to get the features(icons) found inside a closed freehand line.
      The approach I am taking is to take the extent returned from the drawing and
      use it to get the features(icons) inside the drawing. This works. It includes some extra features(icons). Is there a better approach to finding featues(icons) inside the freehand drawing that is more accurate? If not I have had some success using the following:



      The extent returned with draw.on('drawend', function (event) {
      is used to get features in closed line drawn on map.



      vectorSource.forEachFeatureInExtent will have features not inside drawing



      var geomA = event.feature.getGeometry();

      var bhpoints = geomA.flatCoordinates;


      I use these flatCoordinates(xy) to compare to each feature to get a more
      accurate decision whether the feature is in or outside of the closed line.



      This works but will miss once and a while.



      To restate my goal:



      I want to find the features(icons) inside of a freehand drawing and the
      obvious solution with extents needs better accuracy.










      share|improve this question
















      I am not a newbie.
      I am trying to get the features(icons) found inside a closed freehand line.
      The approach I am taking is to take the extent returned from the drawing and
      use it to get the features(icons) inside the drawing. This works. It includes some extra features(icons). Is there a better approach to finding featues(icons) inside the freehand drawing that is more accurate? If not I have had some success using the following:



      The extent returned with draw.on('drawend', function (event) {
      is used to get features in closed line drawn on map.



      vectorSource.forEachFeatureInExtent will have features not inside drawing



      var geomA = event.feature.getGeometry();

      var bhpoints = geomA.flatCoordinates;


      I use these flatCoordinates(xy) to compare to each feature to get a more
      accurate decision whether the feature is in or outside of the closed line.



      This works but will miss once and a while.



      To restate my goal:



      I want to find the features(icons) inside of a freehand drawing and the
      obvious solution with extents needs better accuracy.







      openlayers






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 9 at 18:15









      Vince

      14.7k32749




      14.7k32749










      asked Feb 9 at 17:54









      William HuntWilliam Hunt

      62




      62





      bumped to the homepage by Community 27 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 27 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If by 'closed freehand line' you mean freehand polygon you could check each point feature in the extent is inside the polygon geometry:



          vectorSource.forEachFeatureInExtent(geomA.getExtent(), function(feature) {
          if (feature.getGeometry().getType() == 'Point' && geomA.intersectsCoordinate(feature.getGeometry().getCoordinates()) {
          ....
          ....
          }
          });





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "79"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f311625%2fopenlayers-freehanddraw-foreachfeatureinextent-returns-features-not-in-shape%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            If by 'closed freehand line' you mean freehand polygon you could check each point feature in the extent is inside the polygon geometry:



            vectorSource.forEachFeatureInExtent(geomA.getExtent(), function(feature) {
            if (feature.getGeometry().getType() == 'Point' && geomA.intersectsCoordinate(feature.getGeometry().getCoordinates()) {
            ....
            ....
            }
            });





            share|improve this answer




























              0














              If by 'closed freehand line' you mean freehand polygon you could check each point feature in the extent is inside the polygon geometry:



              vectorSource.forEachFeatureInExtent(geomA.getExtent(), function(feature) {
              if (feature.getGeometry().getType() == 'Point' && geomA.intersectsCoordinate(feature.getGeometry().getCoordinates()) {
              ....
              ....
              }
              });





              share|improve this answer


























                0












                0








                0







                If by 'closed freehand line' you mean freehand polygon you could check each point feature in the extent is inside the polygon geometry:



                vectorSource.forEachFeatureInExtent(geomA.getExtent(), function(feature) {
                if (feature.getGeometry().getType() == 'Point' && geomA.intersectsCoordinate(feature.getGeometry().getCoordinates()) {
                ....
                ....
                }
                });





                share|improve this answer













                If by 'closed freehand line' you mean freehand polygon you could check each point feature in the extent is inside the polygon geometry:



                vectorSource.forEachFeatureInExtent(geomA.getExtent(), function(feature) {
                if (feature.getGeometry().getType() == 'Point' && geomA.intersectsCoordinate(feature.getGeometry().getCoordinates()) {
                ....
                ....
                }
                });






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 9 at 21:22









                MikeMike

                2,215139




                2,215139






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f311625%2fopenlayers-freehanddraw-foreachfeatureinextent-returns-features-not-in-shape%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    (145452) 2005 RN43 Классификация | Примечания | Ссылки |...

                    Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                    Энтрерриос (город) Содержание История | Географическое...