[mapserver-users] Split Polygon using Clint or server side code not with PostGIS

Joshua Hevenor jhevenor at rogers.com
Tue Sep 7 03:41:14 PDT 2010


Ven, 
First,  I took a quick look at the php mapscript documentation (my preferred mapscript) and didn't see anything specific about splitting. Solving a more simplified problem might be a start.

Start by getting the bounding box of the polygon ($shp->bounds). 
Get the two left side coordinates: $p1=(MinX, MaxY), $p2=(MinX, MinY)
Build a new polygon using these two points and the endpoints of your line. 
--> Assumption that your line is not horizontal or intersects the left edge of your bbox. 

Use the shapeObj::intersection to get the half of your target polygon within the left half of the BBOX. 

You can repeat this for the right half of the BBOX, or maybe use shapeObj::difference.

My first thoughts. 

You could, alternatively, loop through all of $shp->lines(1..$shp->numlines) and checking for intersection with your split line. A little bookkeeping would allow you to build your two split polygons from this.  I think option 1 might be easier. 

Hope this helps, 

Josh

--- On Tue, 9/7/10, venkat <ven.tammineni at gmail.com> wrote:

From: venkat <ven.tammineni at gmail.com>
Subject: [mapserver-users] Split Polygon using Clint or server side code not with PostGIS
To: mapserver-users-request at lists.osgeo.org, mapserver-users at lists.osgeo.org
Date: Tuesday, September 7, 2010, 1:46 AM

Dear All,
   How i can split polygon by client(JavaScript code) or Server side(C#).I have done splitting polygon using Postgis..I am not able to understand how to split polygon by code(client or server side code.Please let me know .Its very urgent.

 I am waiting for your great response.
Thanks and Regards,

Ven

-----Inline Attachment Follows-----

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100907/7f9d6492/attachment.htm>


More information about the MapServer-users mailing list