I'm trying to create a points in the middle of polylines. The data is now in the form of shapefile. Is there an easy way to do this?
3 Answers
This is a simple way to find the center of lines in QGis: Vector > Analysis > Mean Coordinates
This worked very nice and fast.
Points are created in another shapefile, and the attribute table already comes with the coordinates along with the Unique ID field you selected earlier.
I tried before to convert the lines into polygons, then extracting the polygon centroids, but the new solution is one step shorter.
- 65,136
- 29
- 109
- 338
- 59
- 1
- 2
-
This does not help. I tried this on an exploded line layer that was converted from a polygon layer, but it creates centroids outside the lines instead of in the center of the exploded lines. – JAT86 Jul 24 '21 at 00:32
if you have qgis;
- use SPIT - Shapefile to PostGIS Import Tool to adding your shapefile as postgis table
- run this query:
.
SELECT id, ST_AsText(ST_Centroid(the_geom)) as Cetroids FROM myPolyLines;
or
SELECT id,CENTER(the_geom) as Cetroids FROM myPolyLines;
ST_Centroid — Returns the geometric center of a geometry.
Computes the geometric center of a geometry, or equivalently, the center of mass of the geometry as a POINT. more info
it will return you centroid of your line then you can update or set it as new column or anything.

use feature vertices to point in arcmap : Arctoolbox => data management tools => Features => Feature Vertices to point => select mid point type .
- 5,825
- 4
- 45
- 88


Feature Vertices to Pointstool to get the midpoint of a line as stated in this question. You can do this in 10.1 with a trial licence (Advanced). – Cindy Jayakumar Nov 15 '12 at 08:27