[OpenLayers-Users] split features
Chris Green
chris.green at ibstv.co.uk
Fri Aug 6 05:40:47 EDT 2010
Tim
Thanks very much for your advice.
It seems that:
parts = knifeLine.geometry.split(worm.geometry);
works when both knife and worm are defined as a linestring, but what I
really want is to create a split in a linestring at the nearest vertex to a
point. I can see from the reference you sent that it *should* be possible to
make knife into a point and define a tolerance within which a vertex will be
found, but with knife defined as a point I get the error:
knifePoint.geometry.split is not a function
I get the same error if I define knife as a regular polygon. I'm wondering
if the split source has to be a linestring?
Regards
Chris
PS: I'm using OL 2.8
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Tim Schaub
Sent: 05 August 2010 02:50
To: users at openlayers.org
Subject: Re: [OpenLayers-Users] split features
Not currently documented as part of the API (should be), but LineString
and MultiLineString geometries have a split method.
http://dev.openlayers.org/docs/files/OpenLayers/Geometry/LineString-js.html#
OpenLayers.Geometry.LineString.split
If you have one feature named "knife" and another named "worm", then you
could get the relevant parts as follows:
var parts = knife.geometry.split(worm.geometry);
Tim
On 8/4/10 2:08 AM, Chris Green wrote:
> Hi all
>
> I am wondering if there is a way to use the split control to split line
> features programmatically rather than by a user identifying on a sketch
> layer where a split should be made?
>
> I can determine in javascript where I want to split the feature and I
> don't want the user involved - does anyone know a way to do that?
>
> Chris
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list