I think you may be looking at a "clipping operation" then.

You will want to loop over each road; you can perform a union with your polygon 
to get just the section of the road that is inside the polygon.

-- 
Jody Garnett

On Friday, 1 April 2011 at 2:06 AM, mounir younes wrote: 
> I have tested coveredBy, intersects, within, and contains and they all fail.
> 
> What I have is a set of line strings over a polygon and I want to delete 
> linestrings that are outside of the polygon ! how do I do that ?
> 
> Attached is the picture of my problem. In other words I want the parts of the 
> roads outside the polygon to disappear? should I loop over each part of each 
> road?
> 
> On Thu, Mar 31, 2011 at 4:52 PM, Jody Garnett <[email protected]> wrote:
> > This is another case where reading the javadocs should I hope help?
> > - 
> > http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html
> > 
> > Both contain and within have some funny language about if the linestring 
> > touches the "edge" of your polygon.
> > 
> > You may want to try the jts coveredBy as an alternative? (and are you sure 
> > you are not trying to test intersects? - ie test if any part of the 
> > linestring is inside the polygon?) 
> > 
> > Finally if none of the out of the box methods work for you; you can say 
> > exactly what you need:
> > - http://docs.geotools.org/latest/userguide/guide/library/jts/dim9.html
> > 
> > -- 
> > Jody Garnett
> > 
> > On Thursday, 31 March 2011 at 11:16 PM, mounir younes wrote: 
> > > I want to check if a linestring is inside a polygon ! how can I do t 
> > > that? I tried .contains and .within but both failed !! can someone help me
> > > ------------------------------------------------------------------------------
> > > Create and publish websites with WebMatrix
> > > Use the most popular FREE web apps or write code yourself; 
> > > WebMatrix provides all the features you need to develop and 
> > >  publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
> > > _______________________________________________
> > > Geotools-gt2-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > > 
> > 
> 
> Attachments: 
> - .png
> 
> 

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to