Best way to select features within features

4095
11
Jump to solution
07-17-2015 07:27 AM
TimWitt2
MVP Alum

Hey everybody,

I am looking for a way to select points from a feature layer that fall within this feature layer: Layer: Atl_slr_merged_2ft (ID: 6)

It sounds easy enough if you use ArcGIS Desktop but in javascript I am running into issues.

Using the method described here would work, union and then use the geometry of the union feature to select what falls within it. But if your feature layer has thousands of polygons, the union would take forever.

So my question is, am I approaching this issue wrong? Is my only option to union the layer before publishing it on a server ( which I sadly can't do, because I don't have the feature layer and rely on NOAA hosting it).

Any input would be greatly appreciated!

Thanks,

Tim

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Tim,

   I would tackle this in a multi-step solution then.

  1. Take the users input point layer and add all the points to a new MultiPoint Geometry
  2. Use the new MultiPoint geom to query the NOAA Polygons.
  3. Take those NOAA Polygon results from the query and send then to the Geometry service to union them.
  4. Take the unioned geom and do the intersect using the individual user points

View solution in original post

11 Replies
RobertScheitlin__GISP
MVP Emeritus

Tim,

   You may need to consider your workflow for this. Do you really need to use all of the polygons from the NOAA map service in your app? Can you not set your workflow to minimize the intersect query before it is performed (i.e. have the user do some query to minimize the polygons evaluated or only query the polygons in the current map extent)?

TimWitt2
MVP Alum

Robert,

that might be an idea. Maybe I should have explained what my goal is.

I would like the user to be able to add their point featurlayer and see which points would fall within the flood zone.

Tim

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tim,

   What does their point FL represent? Will it be a handful of points, hundreds, thousands?

0 Kudos
TimWitt2
MVP Alum

Robert,

I would say anywhere between 10 - 200.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tim,

   I would tackle this in a multi-step solution then.

  1. Take the users input point layer and add all the points to a new MultiPoint Geometry
  2. Use the new MultiPoint geom to query the NOAA Polygons.
  3. Take those NOAA Polygon results from the query and send then to the Geometry service to union them.
  4. Take the unioned geom and do the intersect using the individual user points
TimWitt2
MVP Alum

That is a great idea, I'll try that.

I just wish the javascript API had a similar tool like ArcGIS Desktop "Select by location"

Thanks!

0 Kudos
TimWitt2
MVP Alum

One more question, how do I do step one?

I assume this happens here?

map.on('layer-add-result', function (evt){
    //What code do I need?
});
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tim,

   Can one assume that the layer has been added as a FeayureLayer and thus you will have access to the layer geometry without doing a QueryTask?

0 Kudos
TimWitt2
MVP Alum

Yes, it will be a FeatureLayer.

0 Kudos