How to get Center Point of the Geometry - PostgreSQL

random

How to get Center Point of the Geometry - PostgreSQL

Postgis - How do I find the center of a number of geographic points?


In the previous post I explained how to Convert Latitude, Longitude to Geography Point in PostGIS, Get Latitude and Longitude from Geometry Point in PostGres


Now I will explain how to get Center point of the Geometry. We use ST_Centroid function here in PostgreSQL. It Returns the geometric center of a geometry.


Example 1: In Geometry format

select ST_Centroid("sp_geometry") from "Delhi_Zone" where "ZONE" in('West')

 

Database,How to,GIS,Interview Questions, IQ,Sql Database,Postgres, Postgresql,QA,Question Answer


Example 2: In Text format

Select ST_Y(ST_Centroid("sp_geometry")) , ST_X(ST_Centroid("sp_geometry")) from "Delhi_Zone" where "ZONE" in('West')



Database,How to,GIS,Interview Questions, IQ,Sql Database,Postgres, Postgresql,QA,Question Answer


for more visit http://workshops.opengeo.org/postgis-intro/geometry_returning.html


How to get Center Point of the Geometry - PostgreSQL Reviewed by Ravi Kumar on 6:18 PM Rating: 5

No comments:

All Rights Reserved by Etechpulse © 2012 - 2017

Contact Form

Name

Email *

Message *

Powered by Blogger.