Ahoy there,<br><br>Well they don't overlap, they intersect. Had a similar problem and realized that a geometry that intersects doesn't necessarily overlap.use relate to see how the two geometries interact.<br>If you can find out how to decipher the output from the relate command drop me a line, cuz i cant find it anywhere on the net.
<br><br>SELECT road_id, relate(b.the_geom,a.the_geom) FROM road_segments a, curves b WHERE a.the_geom && b.the_geom AND <span style="font-weight: bold;">intersects</span>(a.the_geom, b.the_geom);<br><br> road_id |  relate
<br>---------+-----------<br>      10 | 1FFF0FFF2   <<< the original row<br>      10 | 1F1F00102    <<< modified the original row so this row overlaps.<br>(2 rows)<br><br>SELECT road_id, relate(b.the_geom
,a.the_geom) FROM road_segments a,
curves b WHERE a.the_geom && b.the_geom AND <span style="font-weight: bold;">overlaps</span>(a.the_geom, b.the_geom);<br> road_id |  relate<br>---------+-----------<br>      10 | 1F1F00102  <<< modified the original row so this row overlaps. 
<br>(1 row)<br><br><br>hope that helps<br><br>Rhys<br><br><br><br><div><span class="gmail_quote">On 7/3/07, <b class="gmail_sendername">Jonathan Aguero</b> <<a href="mailto:jua130@psu.edu">jua130@psu.edu</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Mark,<br>Thanks for your answer, here it is the sql you request<br>CREATE TABLE lrs2 (gid int4, road_inv varchar(4));
<br>SELECT AddGeometryColumn('lrs2', 'the_geom', 2927, 'LINESTRINGM', 3);<br>INSERT INTO LRS2 (gid,road_inv, the_geom) VALUES<br>(1, '290', GeomFromText('LINESTRINGM(2406383.283 861534.851
 0.07,2406359.112<br>861586.107 0.082,2406335.853 861620.089 0.091,2406310.002 861656.69<br>0.101,2406255.656 861722.092 0.12,2406212.863 861767.807 0.133,2406167.562<br>861808.508 0.147,2405858.946 862103.134 0.24,2405700.764
 862300.136<br>0.26,2405597.455 862454.556 0.313,2405561.594 862504.091 0.33,2405526.644<br>862606.293 0.35,2405376.043 863080.764 0.444,2405107.283 863988.701<br>0.622,2405089.364 864074.548 0.639,2405083.673 864156.245 
0.654,2405087.106<br>864240.691 0.67,2405115.272 864242.612 0.675,2405814.858 864282.694<br>0.8,2406187.349 864301.081 0.869,2407373.155 864345.473 1.09,2408850.001<br>864414.309 1.37,2409646.552 864450.813 1.522,2409724.132
 864459.6<br>1.537,2409866.429 864498.596 1.565,2410149.525 864603.864 1.623,2410692.582<br>864788.24 1.733,2411535.108 865067.94 1.902,2411877.4 865184.391<br>1.971,2411997.555 865229.746 1.996,2412066.702 865258.947 2.01
,2412122.725<br>865291.502 2.022,2412189.604 865347.555 2.039,2413099.432 866096.864<br>2.264,2413233.115 866208.772 2.297,2413337.133 866308.421 2.325,2413649.134<br>866597.512 2.406,2414104.962 867058.318 2.53,2414174.266
 867117.086<br>2.547,2414329.433 867259.172 2.586,2414541.968 867377.955 2.631,2415561.425<br>867898.663 2.843,2415663.666 867950.203 2.865,2415711.381 867964.733<br>2.874,2415760.712 867974.327 2.883,2415834.682 867983.789
 2.897,2415954.61<br>867986.436 2.919,2417079.882 868026.214 3.128,2417170.24 868029.877<br>3.145,2417195.169 868042.176 3.15,2417721.664 868392.441 3.27,2417796.276<br>868423.849 3.285,2418197.637 868559.305 3.366,2418832.192
 868788.621<br>3.495,2419543.831 869053.946 3.641,2419770.891 869135.697 3.687,2419997.995<br>869225.542 3.733,2421265.462 869754.998 3.996,2421387.091 869796.842<br>4.021,2421476.281 869826.718 4.038,2421571.488 869846.445
 4.057,2421664.639<br>869860.112 4.075,2421870.976 869869.151 4.115,2422422.273 869893.302<br>4.22,2423118.185 869912.227 4.351,2423322.658 869910.882 4.39,2423543.675<br>869887.113 4.432,2423761.002 869840.387 4.474,2423900.347
 869825.931<br>4.5,2425047.751 869848.138 4.717,2425262.25 869851.04 4.757,2425349.276<br>869854.623 4.773,2425426.24 869868.376 4.788,2425559.956 869900.037<br>4.814,2425663.321 869931.861 4.834,2425807.25 869981.679 4.863
,2427651.83<br>870598.722 5.23,2428262.085 870816.397 5.353,2430198.032 871483.911<br>5.74,2431505.587 871940.293 6,2432815.135 872390.593 6.26,2435415.059<br>873293.352 6.78,2437780.605 874089.52 7.257,2437820.359 874103.312
<br>7.265,2438045.344 874181.343 7.31,2438366.008 874269.892 7.373,2438966.15<br>874475.042 7.494,2440234.314 874916.234 7.749,2442988.007 875863.599<br>8.303,2443271.918 875961.321 8.36,2443560.018 876049.762 8.416,2443608.255
<br>876068.505 8.426,2443666.681 876097.327 8.438,2443732.747 876133.708<br>8.452,2443788.707 876175.211 8.465,2444125.925 876459.689 8.546,2444432.057<br>876711.694 8.62,2444631.05 876873.741 8.672,2444787.543 877000.844
<br>8.712,2444943.989 877119.08 8.751,2445073.637 877200.723 8.782,2445208.325<br>877277.273 8.813,2445344.218 877342.415 8.843,2445453.449 877396.299<br>8.868,2445811.841 877539.109 8.945,2445825.476 877557.714 8.95,2445938.059
<br>877587.195 8.972,2446085.112 877622.033 9,2446299.084 877660.47<br>9.04,2446608.007 877688.501 9.098,2447923.128 877847.699 9.346,2448425.232<br>877912.299 9.44,2452388.897 878388.295 10.2,2452678.1 878436.029<br>10.26
,2452785.541 878453.306 10.28,2452839.486 878461.985 10.29,2452936.212<br>878477.791 10.309,2453147.417 878512.326 10.35,2453203.975 878520.16<br>10.361,2453529.509 878565.275 10.424,2453718.67 878587.397 10.46,2454143.639
<br>878624.842 10.541,2454592.191 878672.24 10.628,2454813.568 878695.375<br>10.67,2455810.625 878816.796 10.861,2456783.057 878923.353<br>11.046,2457948.075 879068.144 11.269,2459000.96 879187.493 11.47,2459503.893<br>879234.27
 11.566,2459785.345 879264.009 11.619,2460056.408 879299.012<br>11.671,2460426.624 879367.34 11.743,2460854.335 879471.822<br>11.826,2461219.594 879587.06 11.899,2462427.66 879986.859 12.14,2463875.818<br>880473.917 12.43
,2464522.953 880697.024 12.558,2465634.74 881112.965<br>12.78,2466133.525 881277.739 12.86,2466464.64 881418.43 12.931,2468377.709<br>882145.196 13.333,2469223.238 882450.574 13.51,2470998.744 883136.062<br>13.871,2471904.723
 883482.827 14.055,2472282.975 883623.285<br>14.132,2474415.388 884367.481 14.56,2476883.851 885294.585<br>15.057,2477619.048 885577.557 15.205,2478111.881 885802.791<br>15.307,2478588.523 886044.39 15.408,2479003.256 886276.557
<br>15.497,2479643.615 886689.823 15.641,2479954.098 886909.531<br>15.713,2482447.575 888637.839 16.284,2483535.9 889406.806 16.535,2484758.36<br>890295.507 16.82,2485433.873 890812.227 16.982,2486278.785 891394.59<br>17.177
,2486869.777 891816.656 17.315,2487564.761 892296.149<br>17.475,2488317.986 892821.017 17.649,2489120.621 893384.276<br>17.836,2489836.725 893868.926 18,2491205.446 894830.469 18.31)', 2927<br>));<br><br>CREATE TABLE road_segments (road_id int4, road_inv varchar(4),begmp real,
<br>endmp real);<br>SELECT AddGeometryColumn('road_segments', 'the_geom', 2927, 'LINESTRING',<br>2);<br>INSERT INTO road_segments (road_id,road_inv, begmp, endmp) VALUES<br>(10, '290', 1.48
, 1.79);<br>UPDATE road_segments SET the_geom =<br>force_2d(locate_between_measures(lrs2.the_geom,begmp,endmp))<br>FROM lrs2;<br><br>CREATE TABLE curves (curve_id int4, road_inv varchar(4),begmp real, endmp<br>real);<br>SELECT AddGeometryColumn('curves', 'the_geom', 2927, 'LINESTRING', 2);
<br>INSERT INTO curves (curve_id,road_inv, begmp, endmp) VALUES<br>(100, '290', 1.48, 1.79);<br>UPDATE curves SET the_geom =<br>force_2d(locate_between_measures(lrs2.the_geom,begmp,endmp))<br>FROM lrs2;<br><br>SELECT road_id FROM road_segments, curves
<br>WHERE road_segments.the_geom && curves.the_geom AND<br>overlaps(road_segments.the_geom, curves.the_geom);<br><br><br><br>The last SELECT is returning null in my system which means GEOS is failing<br>to detect the overlap.
<br><br>Jonathan Aguero Valverde<br>Research Assistant and Ph.D. Candidate<br>Pennsylvania State University<br>The Pennsylvania Transportation Institute<br>201 Transportation Research Building<br>University Park, PA 16802
<br><a href="http://www.personal.psu.edu/jua130">www.personal.psu.edu/jua130</a><br><br>-----Original Message-----<br>From: <a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net
</a><br>[mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>] On Behalf Of Mark<br>Cave-Ayland<br>Sent: Monday, July 02, 2007 5:45 PM<br>To: PostGIS Users Discussion
<br>Subject: Re: [postgis-users] Problem with overlay<br><br>On Sat, 2007-06-30 at 14:05 -0400, Jonathan Aguero wrote:<br>> Listers<br>><br>> I got a multilinestringM shape that I loaded into postgis without<br>> problem (LRS). Then I used the linear referencing functions to create
<br>> the segments and curves tables from the tables (BTW, these linear<br>> referencing functions rock!!!!). Now, my problem is that when I tried<br>> to join the information on curves into the segments table using the
<br>> overlay function, it failed to detect several curves. Note that both<br>> geometries (segments and curves) are generated from the same base<br>> lines (LRS), therefore all curves should overlay one or more segments.
<br>> I am guessing I encountered a precision problem on GEOS but I wonder<br>> whether my guess is correct and if there is any solution (maybe<br>> snaptogrid).<br>><br>> Thanks in Advance for your help<br>
><br>> PS:<br>><br>> OS: Windows XP<br>><br>> PGSQL: PostgreSQL 8.2.3 on i686-pc-mingw32, compiled by GCC gcc.exe<br>> (GCC) 3.4.2 (mingw-special)<br>><br>> Postgis: 1.2<br>><br>> GEOS: 3.0.0rc4-CAPI-1.3.3
<br>><br>><br>><br>><br>><br>> Jonathan Aguero Valverde<br>><br>> Research Assistant and Ph.D. Candidate<br>><br>> Pennsylvania State University<br>><br>> The Pennsylvania Transportation Institute
<br>><br>> 201 Transportation Research Building<br>><br>> University Park, PA 16802<br>><br>> <a href="http://www.personal.psu.edu/jua130">www.personal.psu.edu/jua130</a><br><br><br>Hi Jonathan,<br><br>Not sure about whether I can help you, however we need a concrete test
<br>case to able to determine whether this is a bug or not. Basically an SQL<br>file containing a couple of tables containing some sample geometries<br>along with the join you are using would be a great help.<br><br><br>Kind regards,
<br><br>Mark.<br><br>--<br>ILande - Open Source Consultancy<br><a href="http://www.ilande.co.uk">http://www.ilande.co.uk</a><br><br><br>_______________________________________________<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net">
postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br><br>_______________________________________________
<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users
</a><br></blockquote></div><br>