Select to view content in your preferred language

Select and Get Geometry

2200
7
Jump to solution
06-27-2014 05:33 AM
jaykapalczynski
Frequent Contributor
I want to target a specific Layer in my app (make that selectable to this tool)
Allow the user to select a feature in the map
Get its Geometry and select features inside that geometry

What would be my option?  any examples?
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Hi Jay,

Is something like this example what you are looking for?  The app allows you to select a county, and all of the cities within that county are selected.

View solution in original post

0 Kudos
7 Replies
jaykapalczynski
Frequent Contributor
I think I can do something like this

 map.on("click", function(evt) {
            selectQuery.geometry = evt.mapPoint;
            petroFieldsFL.selectFeatures(selectQuery, FeatureLayer.SELECTION_NEW, function(features) {
              if (features.length > 0) {
               //store the current feature
                updateFeature = features[0];

// Dont know how to Highlight the feature
// How do I grab its Geometry and use it for a Buffer Select

              } else {

              }
            });
          });
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Hi Jay,

Is something like this example what you are looking for?  The app allows you to select a county, and all of the cities within that county are selected.
0 Kudos
jaykapalczynski
Frequent Contributor
Yes this is....perfect.....Cheers...I simply need the Geometry of the selected Feature.  I am then using that Geometry to feed an Extract GP tool...
Thanks
0 Kudos
jaykapalczynski
Frequent Contributor
I do have one last question.

I am doing to below to select a specific feature and create a graphic.  Works fine.

But I cannot turn it off....how do I turn off the MAP CLICK to this feature.  I want to use to have to select the button every time the wish to use this.

        registry.byId("RegionSelection").on("click", function() {
             var highlightSymbol = new SimpleFillSymbol(
       SimpleFillSymbol.STYLE_SOLID,
       new SimpleLineSymbol(
       SimpleLineSymbol.STYLE_SOLID,
       new Color([255, 0, 0]), 1),
       new Color([125, 125, 125, 0.35]));

       petroFieldsFL2.on("click", function (evt) {
          map.graphics.clear();
          highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol);
          map.graphics.add(highlightGraphic);

          var query = new Query();
          query.geometry = highlightGraphic.geometry.getExtent();
         })
        });
0 Kudos
KenBuja
MVP Esteemed Contributor
Jay, I would suggest reading up on events. The JavaScript API has a good help topic on it and the Dojo documentation for "on" goes into much more detail about how you get more control over events...turning them on and off, pausing them, etc.
0 Kudos
jaykapalczynski
Frequent Contributor
Thanks Ken...will do. Cheers
0 Kudos
jaykapalczynski
Frequent Contributor
.......................................................................
0 Kudos