Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to find the center point of MULTILINESTRING, which lies on the multiline?

I am using SQL in PostGIS

share|improve this question
    
What software are you using? The more details you give, the better an answer you will receive. – sgrieve Sep 17 '12 at 13:22
    
I am using SQL in PostGIS. – Marko Sep 17 '12 at 13:26

Have a look at ST_Line_Interpolate_Point(). If you give 0.5 as the second parameter, it will return a point 1/2 way along the line. BTW, if your layer is a MULTILINESTRING, then "center point" really doesn't have any meaning. For example, a MULTILINESTRING can be non-contiguous or intersecting LINESTRINGs.

share|improve this answer

Here's an algorithm that will work for a use case such as a single road with a T-intersection.

  1. Find the ST_Centroid(geometry g1);
  2. Choose the linestring from the MULTILINESTRING with the min(ST_Distance(centroid,linestring))
  3. ST_Line_Interpolate_Point(line, ST_Line_Locate_Point(line, centroid))

or even simpler

SELECT ST_ClosestPoint(geom, ST_Centroid(geom) FROM table;

share|improve this answer

I have found, the function is called ST_PointOnSurface.

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Technically speaking , you won't find it everytime.

MULTILINESTRING may be collection of strings which may or may not touch eachother.

If Your data type is LINESTRING then you can have middle point every time, @Micha has correct answer for that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.