Can the geometry engine in 4.7 intersect a 3d line with a 3d polygon?

2257
10
Jump to solution
05-06-2018 05:15 PM
RichardHughes2
Occasional Contributor III

When using the geometry engine's intersect method and inputting a line geometry with z-values and a polygon with z-values, the result keeps returning a geometry identical to the input line.  

Is this a supported operation by the api?  While 3d is supported I cannot seem to find documentation on using the Geometry Engine with 3d features.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RalucaNicola1
Esri Contributor

ok, here's a snippet, I hope it helps somehow: Edit fiddle - JSFiddle  It is a very restrained case: polygons are planar, no inner rings and you always look at the intersection of a vertical line with the polygons. For the more complex case where your polygon is not planar you would have to triangulate the polygon and then check each triangle to see if it intersects with the line.

View solution in original post

10 Replies
KristianEkenes
Esri Regular Contributor

Hi Richard. The Geometry Engine only supports 2D geometric operations. While geometries with z values can be used, they will be ignored for all evaluations.

0 Kudos
RichardHughes2
Occasional Contributor III

Hi Kristian,

That is interesting.  The API documentation does not really specify that so cut and dry.  Also, the Identify Task is stated as not supported on 3d Scene Views.  Turns out that because the geometry operations are not working on 3d data, we are using the Identify Task to query pixel values from rasters on a map service to get the differences in elevation between features.  I understand that the extent of the Scene View could causes issues, but when Identifying by a point it works.  What does "Not supported" mean in the context of the javascript api?   

It would be nice to not have to generate rasters to calculate differences in elevation to determine if a feature intersects another.  The Geometry Engine, based on the API seems like the correct solution.  Is it that a Geometry Service is required instead so ArcServer can perform the intersect comparison?  

Thanks,

Rich

0 Kudos
RalucaNicola1
Esri Contributor

Hey Richard, 

Can you tell us more about your use case? What are you trying to do? If you have vector features that have z values, why are you bringing in raster data?

Unfortunately we don't support 3D geometry operations for now, we write that in the geometryEngine documentation: geometryEngine | API Reference | ArcGIS API for JavaScript 4.7: "A client-side geometry engine for testing, measuring, and analyzing the spatial relationship between two or more 2D geometries."

0 Kudos
RichardHughes2
Occasional Contributor III

Hi Raluca,

Thank you for pointing that out with the 2d geometries for the Geometry Engine.  Seeing the Geodesic Buffers 3D kept pulling me towards the impossible.

What we are doing is showing penetrations in an airspace application.  We want to identify what 3d surfaces are intersected by a vertical line representing an obstacle.  We can see the intersection in the Scene, and we measuring them.  The rasters in the map service are not being added to the app.  They are being queried through an Identify Task (which is not supported in the Scene View) and the pixel values are used to calculate the differences in elevation between the surfaces at the specified point.  Does that make sense?  The data is then shown in a table in the app.

The need to create the rasters for calculating the difference in elevation is all they are for.  The rasters are not visible in the Scene and are not used to create a layer, the url is used in an IdentifyTask.  

We would like to be able to determine whether a vertical obstacle intersects a 3d polygon.

0 Kudos
RalucaNicola1
Esri Contributor

hmm still a bit confused when you say surface - does that mean an elevation surface? or do you just have polygons with height values? And are you trying to figure out only which 3D surfaces are intersected by the lines or also where exactly they intersect to do some other measurement?

Anyway your use case sounds quite similar to an app Kristian Ekenes‌ wrote: https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/build-3d-web-apps-with-your-2d-data/  about airspace encroachment, so I want to point you to it.

0 Kudos
RichardHughes2
Occasional Contributor III

Hi Raluca,

You are correct in that when I say surface I am referring to airspace surface.  Those are sloped polygons.  These polygons have z-values defined at each vertex.  They are rendered using absolute-height.  In my local scene we are extruding a point to a height chosen by the user, and the penetration is visible in the app.  I would like to programmatically filter polygons that don't intersect.  There can be a lot of polygons you see. and some of the polygon surfaces have steeper slopes than others.  Right now every polygon that interects in 2d space is visible and is returned from the IdentifyTask.  I was unable to get the Query Task to work on the map service.  It seems to only accept layers within the map service by appending the layer index to the url.  That could also be clarified a bit more in the API.  We have many layers in the map service so I am using the IdentifyTask, eventhough the documentation states that it is not supported in a Scene View. 

To perform the geometry comparison I am creating a polyline with the base and peak elevation of the obstacle with a one foot offset at the peak on the X and Y coordinates to prevent a completely vertical line.  I have been building Queries and executing them on the feature layers in the app with this geometry and it does not work in 3d. 

Actually calculating the penetration, or vertical distance the obstacle protrudes through the surface, is what we rely on the rasters for.  In a completely separate workflow we are generating rasters from the 3d polygons by going polygon->multipatch->raster.  Using an Identify Task on the rasters in a map service with a point geometry returns the pixel value for each raster at that location. 

What I want to do in the Scene View is filter out the polygons (surfaces) that don't intersect the obstacle, or are outside a specified vertical clearance at the location of the obstacle without having to query the rasters.    

I guess I will need to to a Geoprocessing Service to get the job done, yes?  Building and using rasters with a 5x5 ft cell size for the app is outdated when a geometric intersect comparison is all we need.   

I uploaded a video attachment demoing the app functionality.  it is in development

0 Kudos
RichardHughes2
Occasional Contributor III

Raluca,

This morning I drew up a proof for solving the Z-value of a point with a known x, y on a plane defined by three vertexes with x, y, z.  This seems like a calculation that would already be in the api, but if it is not can it be added?

0 Kudos
RalucaNicola1
Esri Contributor

Hi Richard, sorry for the late reply!

You are right, a Geoprocessing Service is for now the clean solution, as we don't have this exposed in the API. We will add these calculations to the GeometryEngine, but as of now, we don't have them there and they will surely not be there by the summer release.

And yes, this should boil down to solving the intersection of a line with the plane in which the polygon resides. One more question: is each polygon lying in a plane? I couldn't see the video, I think it's not linked.. I will try to write a small sample for this; when I have it done, I'll link it here. However, if the polygon is more like a mesh type of geometry then it might need triangulation and then it gets complicated. 

0 Kudos
RalucaNicola1
Esri Contributor

ok, here's a snippet, I hope it helps somehow: Edit fiddle - JSFiddle  It is a very restrained case: polygons are planar, no inner rings and you always look at the intersection of a vertical line with the polygons. For the more complex case where your polygon is not planar you would have to triangulate the polygon and then check each triangle to see if it intersects with the line.