# convert points to polyline to polygon to calculate area

2515
3
09-08-2015 09:15 AM
New Contributor

Hello All, good morning!

I have a set of points (lat and lon) that shows a vehicle route/path, I want to get the area covered by that vehicle.

What would be the best approach to get this done?

Cycle through each point to build a polygon, joining first and last point?

How do I build a polygon that has all points as a perimeter?

Best Regards

1 Solution

Accepted Solutions
Esri Notable Contributor

@Dan not if you use the geodesic area calculations provided by the geometry engine 😉 In that case it's actually better - I'm a big believer in never doing area calculations in a projection but keeping it all in spherical coordinates and using ellipsoidal calculations.

But to answer the question: You can create a polygon from a set of points, and you can get that set of points from the polyline path. Ex:

var myPolygon = new Polygon(myPolyline.Parts[0], myPolyline.SpatialReference);

Alternatively use the PolygonBuilder to add vertices one by one in a loop, and call ToGeometry() when you're done.

3 Replies
MVP Legendary Contributor

don't forget that you will also have to project your data to something other than a geographic coordinate system or your areas will be meaningless.

Esri Notable Contributor

@Dan not if you use the geodesic area calculations provided by the geometry engine 😉 In that case it's actually better - I'm a big believer in never doing area calculations in a projection but keeping it all in spherical coordinates and using ellipsoidal calculations.

But to answer the question: You can create a polygon from a set of points, and you can get that set of points from the polyline path. Ex:

var myPolygon = new Polygon(myPolyline.Parts[0], myPolyline.SpatialReference);

Alternatively use the PolygonBuilder to add vertices one by one in a loop, and call ToGeometry() when you're done.

MVP Legendary Contributor

I know...just trying to head off the..."my areas are wrong" comments...geodesic, I can guarantee you, is not widely understood by a significant number of people using GIS...some are just now getting comfortable with projection...although Define Projection and Project and ArcMap Project do present some conceptual difficulties given the overuse of the term...but that is for another project