Hi,

Just to say that last I looked, intersection with JTS was using double 
precision floating point Java and may result in error calculating the 
intersection points. You may be able to force the intersection to be on one 
line or another, but still... If the error for you is so small that you don't 
mind, then forget all this precision rambling. I think Jody is right and that 
clipping is probably the easiest way. However, a visual effect may be possible 
by rendering the external lines as invisible or rendering something over the 
top of them (masking).

If you need to do the intersection with more precision then you will have to 
think about how much error you will tolerate and maybe implement methods using 
BigDecimal arithmetic or go even further and use numbers that allow you to 
represent them as fractions or something even more complex.

Best wishes,

Andy
http://www.geog.leeds.ac.uk/people/a.turner/
 

-----Original Message-----
From: Michael Bedward [mailto:[email protected]] 
Sent: 01 April 2011 00:18
To: mounir younes; geotools users
Subject: Re: [Geotools-gt2-users] check if geometry is inside another

Hi,

Can I encourage you to join the JTS mailing list:

https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

You can also search the list archives and you'll find that questions
very similar to this have been discussed previously.

Michael

On 1 April 2011 09:23, Jody Garnett <[email protected]> wrote:
> 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
>
>

------------------------------------------------------------------------------
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

------------------------------------------------------------------------------
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