Create polylines, polygons and envelopes (rectangles)

Draw polylines, polygons and envelopes on the map and get their lengths or areas.

Image of geometry

How to use the sample

  1. Open the scene.
  2. Click on the ArcGISMap GameObject and set your API key in the Inspector window.
  3. Click play.
  4. While holding shift, click to place points to create polylines and polygons; drag to create envelopes. Switch between tabs to switch between different types of geometries.

How it works

This sample uses the geometry API for creating polygons, envelopes and calculate areas. It uses Unity's line renderer to create polylines, and use the geometry API to calculate distance. The distance calculated is geodetic distance, also called geodesic distance. The area calculated is geodetic area. You could also use the polyline builder to create polylines. But you can only get the planar distance with polylines created this way.

Note that the polyline distance calculation accounts for elevation but is an approximation. The polygon and envelope calculation don't take elevation into account.

About the data

Basemap is navigation (night) hosted by Esri.

Elevation data is loaded from the Terrain 3D elevation layer hosted by Esri.

Tags

geometry engine, polygon, polyline, envelope, measure, spatial analysis

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.