Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How to split/cut a polygon through OpenLayers split method and same editing save to the PostGIS?

share|improve this question
1  
are you going through geoserver or directly to postgis? –  CaptDragon Mar 13 '12 at 16:07

2 Answers 2

you can split or cut your polygon at server side by means of postgis function. in postgis ST_Split function makes what you want. this function is opposite of ST_Union...

following example has taken from postgis api doc. :

SELECT ST_Split(circle, line)
FROM (SELECT 
    ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 190)) As line,
    ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) As circle) As foo;

and another solution for this is that you can check JTS Topology Suite. it has lots of feature with Geometry Operations.

some example of operation:

contains, within
covers, coveredBy
intersects, disjoint
crosses
overlaps
touches
equals 
share|improve this answer

OpenLayer's Split control is straight forward. You pass it a layer in the contructor and the control will split it.

If your layer has ONE feature and you split it using the control you will end up with TWO features in the layer.

Once youre ready to save to PostGIS, you can write those features to a number of different formats WKT, KML, GML, etc. And pass that to your backend webservice wether it be a GeoServer WFS-T or a PHP, C# or other back-end handler/service that will save the features to your postGIS database.

Example

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.