how to create an arcgis polygon in unity, is there any example?

402
2
05-21-2023 11:29 PM
SidonFutterknecht
New Contributor

I couldn't find any example of creating a polygon in Unity, I hope you can help me.

0 Kudos
2 Replies
Rachael_Ellen
Esri Contributor

Hello,

There are code snippets that show how to create a polygon for the ArcGIS Maps SDK for Unity available on the developers guide pages (see below). Hopefully this will help! 

https://developers.arcgis.com/unity/spatial-and-data-analysis/geometry/#polygon

0 Kudos
mericeen
New Contributor

Hi,

Code snippets that show how to create a polygon for the ArcGIS Maps SDK for Unity are completely wrong. This code works for creating a polygon.

ArcGISPolygonBuilder pb = new ArcGISPolygonBuilder(ArcGISSpatialReference.WGS84());
pb.AddPoint(x1, y1);
pb.AddPoint(x2, y2);
pb.AddPoint(x3, y3);
pb.AddPoint(x4, y4);

ArcGISPolygon polgon= (ArcGISPolygon)pb.ToGeometry();

 

0 Kudos