<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial>Hi all,</FONT></DIV>
<DIV><FONT face=Arial>Here is a copy of a question I sent in July. Since I did
not receive any answer yet, I post it again. </FONT></DIV>
<DIV><FONT face=Arial>Thanks</FONT></DIV>
<DIV><FONT face=Arial>Maude Giasson</FONT></DIV>
<DIV><FONT
face=Arial>-------------------------------------------------------------------------------------------------------------------<BR>I'm
doing a small application using GEOS.<BR><BR>Given two simple linearRings L1 and
L2, my application create a new<BR>linearRing L3 which is similar to L1 but
contains, in addition, new vertex<BR>at the points where L1 and L2
cross.<BR><BR>If L1 and L2 cross on a vertex of L1, no vertex is
added.<BR><BR>If L1 and L2 share a common lineSegment, vertex are added to L3 at
the<BR>endPoints of the segment. (if they are not already vertex on
L3).<BR><BR>In consequence, every edges and vertex of L3 should be within
L1.<BR><BR>1- Does a similar function already exists in GEOS (I haven't find
any) ?<BR><BR>2- Later in my application, I look if the edges of L3 are within
L1 or not<BR>(they should be within L1). It does not work pretty well. The
problem seems<BR>to come from GEOS which is not always consistent in it's
answers. In fact, I<BR>think the real problem is from my side because I do not
know what I can<BR>expect from GEOS answers.<BR>I've made here a little example
showing some GEOS results that I don't<BR>understand. Can someone please tell me
what is wrong in that example?<BR>Understanding this particular example will
help me solving problems in my<BR>application.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>3- I'd like to have more information about the
precisionModel. How does it work ?</FONT><FONT></DIV>
<DIV><BR><BR><FONT face=Arial>In that example, GEOS says that the LineString AB
intersects the LineString<BR>XCDY at the point E.<BR>However, it says that
LineString XCDY does not intersect point E.<BR>In consequence, the line segment
ED is not within XCDY.<BR><BR>//Coordinate :<BR>geos::Coordinate
cA(3.8727033436298370, 34.142325401306152);<BR>geos::Coordinate
cB(22.790718823671341, 34.684023857116699);<BR>geos::Coordinate
cC(15.851628303527832, 42.153842926025391);<BR>geos::Coordinate
cD(4.8595705032348633, 28.923076629638672);<BR>geos::Coordinate
cX(12,55);<BR>geos::Coordinate cY(4,28);<BR></FONT></DIV></FONT>
<DIV><FONT face=Arial>//Coordinate E will be given by GEOS and the values are
the following :</DIV></FONT>
<DIV><FONT face=Arial>// E : 9.3254120334165922, 34.298458262089483</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>geos::PrecisionModel g_precisionModel;<BR>int g_SRID =
1;</FONT></DIV><FONT face=Arial>
<DIV><BR>//-- ls AB construction<BR>geos::BasicCoordinateList* bclAB = new
geos::BasicCoordinateList();<BR>bclAB->add(cA);<BR>bclAB->add(cB);<BR>geos::LineString*
lsAB = new geos::LineString(bclAB, &g_precisionModel,<BR>g_SRID);</DIV>
<DIV><BR>//-- ls XCDY construction<BR>geos::BasicCoordinateList* bclXCDY = new
geos::BasicCoordinateList();<BR>bclXCDY->add(cX);<BR>bclXCDY->add(cC);<BR>bclXCDY->add(cD);<BR>bclXCDY->add(cY);<BR>geos::LineString*
lsXCDY = new geos::LineString(bclXCDY,
&g_precisionModel,<BR>g_SRID);<BR><BR>//-- intersection between the 2
lineStrings<BR>geos::Geometry* gABinterXCDY =
lsAB->intersection(lsXCDY);<BR><BR>//The intersection between lineStrings AB
and XCDY occurs at the single<BR>point of coordinate E (9.3254120334165922,
34.298458262089483)<BR>//E is on AB and on CD. Let's verify that XCDY contains
line segment<BR>(lineString) ED.<BR><BR>//-- ls ED
construction<BR>geos::BasicCoordinateList* bclED = new
geos::BasicCoordinateList();<BR>bclED->add(
geos::Coordinate(*(gABinterXCDY->getCoordinate()))
);<BR>bclED->add(cD);<BR>geos::LineString* lsED = new geos::LineString(bclED,
&g_precisionModel,<BR>g_SRID);<BR><BR>//-- <STRONG>lsXCDY should contain
lsED but it does not; why ?<BR></STRONG>Booleen test3 =
lsXCDY->contains(lsED); // why is it false<BR><BR>// gABinterXCDY = lsAB
inter lsXYCD<BR>// but lsXCDY does not intersect gABinterXCDY.<BR>// <STRONG>Why
does it occur ?</STRONG><BR>Booleen test1 = lsXCDY->intersects(gABinterXCDY);
// <EM>why is it false ?</EM><BR><BR><BR>Thanks<BR>Maude
Giasson<BR></DIV></FONT></BODY></HTML>