# Intersection of point, polyline & polygon with Arcade

Question asked by Fallling on Feb 26, 2020
Latest reply on Mar 1, 2020 by xander_bakker

I'm having trouble finding the 3-way intersection of a point, polyline, and polygon. I have 3 feature layers with each containing one of the geometries. When a polygon is selected, I'm trying count the intersection of the point with polylines that are in the polygon boundaries.

I can find the intersection of polygon with point and polygon with polyline, but can't seem to figure out how to then find the point/polyline intersection.

My thought process has been:

- Create 2 feature sets from the point feature layer and polyline feature layer

- Find intersection of those feature sets with the polygon

- Loop through the point feature set, explicitly make a point geometry from the feature, add buffer to the geometry,  test for intersection with the polyline feature set, and increment a counter if intersects returns true

Initially, I wasn't explicitly creating a point geometry from the feature as from my understanding of the arcade documentation, the intersects function should take a feature or geometry as a parameter along with a feature set. However, since that wasn't working, I tried to create the point geometry to see if that would resolve the problem.

This isn't yielding any results, and I'm at loss now. I also tried doing this the reverse way of looping through the polyline feature set and checking for intersection with the point feature set though that also wasn't working (and didn't make as much sense).

Any help would be very much appreciated!

//create feature sets from 2 layers

var accidentFeatureSet = FeatureSetByName(\$map,"Bicycle Accidents 2012 - 2018");
var bikewayFeatureSet = FeatureSetByName(\$map, "Bikeways");

//accidents feature set that intersects with the polygon (\$feature)

var accidents = Intersects(
\$feature,
accidentFeatureSet
);

//bikeway features set that intersects with the polygon (\$feature)
var bikeways = Intersects(
\$feature,
bikewayFeatureSet
);

var accidentOnBikewayCount = 0;

//loop through accidents feature set

//create point geometry for each accident feature and add buffer

//perform intersection of the accident geometry with bikeway feature set

//if intersects == true, increase count

for(var feature in accidents){

var geom = Point(Geometry(feature));

var buffer = BufferGeodetic(geom, 10, 'feet');

if(Intersects(bikeways,buffer) == true)

accidentOnBikewayCount ++;
}