Opened 12 years ago

Closed 3 months ago

#1926 closed defect (fixed)

ST_OffsetCurve creates a strange multi-linestring

Reported by: lexman Owned by: pramsey
Priority: medium Milestone: PostGIS GEOS
Component: postgis Version: 2.1.x
Keywords: Cc: jef

Description

Hi there,

I've encountered a strange behaviour with ST_Linecurve you might be interested in.

When I run this query with a certain geometry you'll read furter :

SELECT asText(ST_Reverse(ST_OffsetCurve(geom,-5000)))

I get a multilinestring as a result : there is a useless extra linestring on the result !

What is strange, is that it works if I run :

SELECT asText(ST_Reverse(ST_OffsetCurve(geom,-4000)))

it works !


Postgis version : "POSTGIS="2.0.2SVN r10051" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.8.0" RASTER" under linux

I'm working with cs : +proj=gall +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs

The geom in question :

LINESTRING(397136.991825913 4765760.97735032,397118.273454364 4765736.97457462,397070.469976475 4765673.66177918,397031.537652807 4765626.38115555,397004.215757245 4765592.91344897,396978.672815412 4765561.6196266,396938.197682314 4765512.86751546,396880.51550119 4765442.28706088,396820.566334781 4765369.15954307,396783.893124921 4765325.1292299,396749.604972495 4765284.14458692,396742.04835488 4765273.96637409,396735.908603068 4765266.83370408,396725.864598822 4765254.94592836,396694.323591758 4765214.56152719,396685.184807331 4765202.86626138,396651.085570345 4765156.88912486,396608.327709009 4765091.65414166,396585.484683679 4765056.86302279,396540.137106515 4764981.00893023,396525.118329006 4764955.84130738,396514.090390175 4764936.27784059,396507.509835669 4764924.24315133,396478.511315573 4764869.10787018,396455.054315061 4764820.00707477,396437.319878097 4764780.24653141,396416.979982351 4764730.39882547,396404.495820334 4764698.32565702,396384.683313526 4764647.30081938,396374.190635109 4764614.85423119,396356.873386409 4764565.06368724,396348.8759661 4764541.05152697,396338.855576284 4764510.17880665,396329.307475069 4764475.83057511,396318.326765098 4764433.2972952,396309.172237717 4764391.884919,396304.740596345 4764369.55986971,396295.578197487 4764320.32487732,396289.965834613 4764286.18086273,396283.157007284 4764247.99535867,396282.306887802 4764241.84810172,396280.417733398 4764224.65164507,396273.530191302 4764171.53407877,396263.549158869 4764099.7713263,396259.117517497 4764049.25798336,396255.095192913 4764015.35232864,396249.341143458 4763954.33366625,396244.445084962 4763911.76792061,396240.776976829 4763887.7454979,396208.684966397 4763650.05919474,396204.150995828 4763608.36599574,396198.373331944 4763565.29182559,396176.522112675 4763401.91676771,396171.744126329 4763366.17871378,396169.130796071 4763341.39872,396149.349775169 4763207.14145641,396128.395904242 4763088.33724423,396113.259054583 4763012.4932236,396096.854897178 4762940.27196457,396078.65604309 4762867.0096299,396057.347955712 4762790.78186805,396043.053354058 4762743.92926979,396012.645839636 4762644.27035768,395992.368915704 4762576.98625514,395970.029664881 4762507.47249881,395932.600793259 4762400.57068974,395852.563618358 4762164.37973867,395829.16958966 4762100.84449426,395765.229584573 4761916.95264158,395695.511915603 4761737.45484095,395627.533842978 4761592.62893323,395600.298533659 4761538.16253346,395532.281103652 4761436.77995256,395512.460725367 4761403.02741501,395493.089021253 4761366.32076872,395484.973528794 4761336.12246116)

Change History (6)

comment:1 by strk, 12 years ago

Milestone: PostGIS GEOS
Summary: ST_Linecurve creates a strange multi-linestringST_OffsetCurve creates a strange multi-linestring

comment:2 by lexman, 12 years ago

A simplier test case :

SELECT asText(ST_OffsetCurve( 'LINESTRING(397136.991825913 4765760.97735032,397118.273454364 4765736.97457462,397070.469976475 4765673.66177918,397031.537652807 4765626.38115555,397004.215757245 4765592.91344897,396978.672815412 4765561.6196266,396938.197682314 4765512.86751546,396880.51550119 4765442.28706088,396820.566334781 4765369.15954307,396783.893124921 4765325.1292299,396749.604972495 4765284.14458692,396742.04835488 4765273.96637409,396735.908603068 4765266.83370408,396725.864598822 4765254.94592836,396694.323591758 4765214.56152719,396685.184807331 4765202.86626138,396651.085570345 4765156.88912486,396608.327709009 4765091.65414166,396585.484683679 4765056.86302279,396540.137106515 4764981.00893023,396525.118329006 4764955.84130738,396514.090390175 4764936.27784059,396507.509835669 4764924.24315133,396478.511315573 4764869.10787018,396455.054315061 4764820.00707477,396437.319878097 4764780.24653141,396416.979982351 4764730.39882547,396404.495820334 4764698.32565702,396384.683313526 4764647.30081938,396374.190635109 4764614.85423119,396356.873386409 4764565.06368724,396348.8759661 4764541.05152697,396338.855576284 4764510.17880665,396329.307475069 4764475.83057511,396318.326765098 4764433.2972952,396309.172237717 4764391.884919,396304.740596345 4764369.55986971,396295.578197487 4764320.32487732,396289.965834613 4764286.18086273,396283.157007284 4764247.99535867,396282.306887802 4764241.84810172,396280.417733398 4764224.65164507,396273.530191302 4764171.53407877,396263.549158869 4764099.7713263,396259.117517497 4764049.25798336,396255.095192913 4764015.35232864,396249.341143458 4763954.33366625,396244.445084962 4763911.76792061,396240.776976829 4763887.7454979,396208.684966397 4763650.05919474,396204.150995828 4763608.36599574,396198.373331944 4763565.29182559,396176.522112675 4763401.91676771,396171.744126329 4763366.17871378,396169.130796071 4763341.39872,396149.349775169 4763207.14145641,396128.395904242 4763088.33724423,396113.259054583 4763012.4932236,396096.854897178 4762940.27196457,396078.65604309 4762867.0096299,396057.347955712 4762790.78186805,396043.053354058 4762743.92926979,396012.645839636 4762644.27035768,395992.368915704 4762576.98625514,395970.029664881 4762507.47249881,395932.600793259 4762400.57068974,395852.563618358 4762164.37973867,395829.16958966 4762100.84449426,395765.229584573 4761916.95264158,395695.511915603 4761737.45484095,395627.533842978 4761592.62893323,395600.298533659 4761538.16253346,395532.281103652 4761436.77995256,395512.460725367 4761403.02741501,395493.089021253 4761366.32076872,395484.973528794 4761336.12246116)' ,-5000))

⇒ "MULTILINESTRING((393196.063748918 4768834.27840999,393210.632101122 4768851.97132609,393258.284420571 4768812.73293662,393245.110905418 4768796.02937953),(390656.300320633 4762633.77998485,390664.415813092 4762663.97829241,391071.103192569 4763699.99626692,391090.474896683 4763736.70291321,391129.077387009 4763805.99364018,391137.126061695 4763828.48089457,391137.991642174 4763830.83170246,391197.103452888 4764005.27157755,391213.491259186 4764052.84342916,391222.49907017 4764078.57092903,391222.52587526 4764078.76307186,391238.557307042 4764198.62531217,391245.27392478 4764253.83964486,391253.646044418 4764319.08033168,391281.509514271 4764525.44836701,391282.531825723 4764535.05197568,391282.681087714 4764536.75331419,391283.205440936 4764541.37992681,391289.912498361 4764604.386122,391293.934822945 4764638.29177672,391294.185493062 4764638.26203901,391311.219374276 4764788.5599039,391316.37259971 4764825.61114522,391320.808534463 4764861.14939335,391329.443873913 4764926.79186996,391330.293993395 4764932.93912691,391355.293791571 4765094.26016783,391367.714981774 4765166.58968648,391379.971048606 4765235.09608252,391389.133447464 4765284.33107491,391400.432610951 4765343.09116576,391404.864252323 4765365.41621505,391427.036054139 4765471.11903864,391436.19058152 4765512.53141484,391477.060783583 4765683.15476556,391488.041493554 4765725.68804547,391511.968500541 4765814.95163181,391521.516601756 4765849.29986335,391583.08586859 4766053.76375325,391593.106258406 4766084.63647357,391605.066493782 4766121.01092213,391613.063914091 4766145.0230824,391620.370802937 4766166.7950245,391648.180730054 4766249.03215664,391723.719884744 4766457.112941,391743.532391552 4766508.13777864,391757.50957676 4766544.05136645,391787.543362302 4766619.39765579,391807.883258048 4766669.24536173,391870.955016378 4766816.98705235,391888.689453342 4766856.74759571,391943.454162598 4766975.34093853,391966.91116311 4767024.44173395,392053.257170896 4767196.57983672,392082.255690992 4767251.71511787,392120.513550615 4767323.04776924,392127.094105121 4767335.0824585,392158.449111162 4767391.55563517,392169.477049993 4767411.11910196,392231.509593615 4767518.05207689,392246.528371124 4767543.21969974,392293.910126207 4767622.47948237,392405.870888887 4767801.09853134,392427.627427766 4767834.23487468,392469.300113351 4767897.81422265,392635.059137476 4768135.40078179,392669.158374462 4768181.37791831,392745.366615469 4768281.47513798,392754.133249186 4768292.69414773,392785.302222492 4768332.60220518,392846.365383888 4768409.2264868,392870.105757561 4768438.42514536,392914.685163058 4768492.47593751,392945.473899021 4768529.27772652,392966.183952542 4768554.14247509,393011.371313994 4768609.26316779,393066.651903481 4768676.90501246,393076.179294938 4768688.52712813,393146.952833527 4768774.59702879,393175.459749856 4768811.74612573,393194.178121405 4768835.74890143))"

whereas : SELECT asText(ST_OffsetCurve( 'LINESTRING(397136.991825913 4765760.97735032,397118.273454364 4765736.97457462,397070.469976475 4765673.66177918,397031.537652807 4765626.38115555,397004.215757245 4765592.91344897,396978.672815412 4765561.6196266,396938.197682314 4765512.86751546,396880.51550119 4765442.28706088,396820.566334781 4765369.15954307,396783.893124921 4765325.1292299,396749.604972495 4765284.14458692,396742.04835488 4765273.96637409,396735.908603068 4765266.83370408,396725.864598822 4765254.94592836,396694.323591758 4765214.56152719,396685.184807331 4765202.86626138,396651.085570345 4765156.88912486,396608.327709009 4765091.65414166,396585.484683679 4765056.86302279,396540.137106515 4764981.00893023,396525.118329006 4764955.84130738,396514.090390175 4764936.27784059,396507.509835669 4764924.24315133,396478.511315573 4764869.10787018,396455.054315061 4764820.00707477,396437.319878097 4764780.24653141,396416.979982351 4764730.39882547,396404.495820334 4764698.32565702,396384.683313526 4764647.30081938,396374.190635109 4764614.85423119,396356.873386409 4764565.06368724,396348.8759661 4764541.05152697,396338.855576284 4764510.17880665,396329.307475069 4764475.83057511,396318.326765098 4764433.2972952,396309.172237717 4764391.884919,396304.740596345 4764369.55986971,396295.578197487 4764320.32487732,396289.965834613 4764286.18086273,396283.157007284 4764247.99535867,396282.306887802 4764241.84810172,396280.417733398 4764224.65164507,396273.530191302 4764171.53407877,396263.549158869 4764099.7713263,396259.117517497 4764049.25798336,396255.095192913 4764015.35232864,396249.341143458 4763954.33366625,396244.445084962 4763911.76792061,396240.776976829 4763887.7454979,396208.684966397 4763650.05919474,396204.150995828 4763608.36599574,396198.373331944 4763565.29182559,396176.522112675 4763401.91676771,396171.744126329 4763366.17871378,396169.130796071 4763341.39872,396149.349775169 4763207.14145641,396128.395904242 4763088.33724423,396113.259054583 4763012.4932236,396096.854897178 4762940.27196457,396078.65604309 4762867.0096299,396057.347955712 4762790.78186805,396043.053354058 4762743.92926979,396012.645839636 4762644.27035768,395992.368915704 4762576.98625514,395970.029664881 4762507.47249881,395932.600793259 4762400.57068974,395852.563618358 4762164.37973867,395829.16958966 4762100.84449426,395765.229584573 4761916.95264158,395695.511915603 4761737.45484095,395627.533842978 4761592.62893323,395600.298533659 4761538.16253346,395532.281103652 4761436.77995256,395512.460725367 4761403.02741501,395493.089021253 4761366.32076872,395484.973528794 4761336.12246116)' ,-4000))

⇒ "LINESTRING(391622.034962265 4762374.24848011,391630.150454724 4762404.44678767,391955.500358306 4763233.26116728,391974.87206242 4763269.96781357,392006.971219779 4763327.58518307,392043.797137211 4763393.68699589,392051.039763334 4763414.51683371,392075.534767288 4763482.95361451,392080.906037414 4763497.54130971,392108.628112924 4763579.34958679,392144.202920962 4763684.33139999,392157.313166 4763722.38888127,392175.5889689 4763774.58699218,392182.780181631 4763798.44930465,392186.769742574 4763811.60582357,392201.822260136 4763860.93960022,392213.325122745 4763943.39381104,392233.677853995 4764095.56512035,392234.155330441 4764099.12501766,392244.653828814 4764185.27610429,392274.057175955 4764403.04908855,392278.236139364 4764442.30633171,392278.854701945 4764449.35691661,392281.027695088 4764468.53024686,392282.949037271 4764486.57936333,392285.730633058 4764510.02645825,392301.685331195 4764650.80218838,392307.804118028 4764694.79573192,392313.108205131 4764737.28913502,392320.016476691 4764789.80311631,392320.866596173 4764795.95037326,392340.866434714 4764925.007206,392353.287624917 4764997.33672465,392363.092478382 4765052.14184148,392372.25487724 4765101.37683387,392381.29420803 4765148.38490655,392385.725849402 4765170.70995584,392403.463290855 4765255.27221471,392412.617818236 4765296.68459091,392445.313979886 4765433.18327149,392456.294689857 4765475.7165514,392475.436295447 4765547.12742047,392484.984396662 4765581.47565201,392534.239810129 4765745.04676393,392544.260199945 4765775.91948425,392553.828388246 4765805.0190431,392561.825808555 4765829.03120337,392567.671319631 4765846.44875705,392595.481246748 4765928.68588919,392655.9125705 4766095.15051667,392675.725077308 4766146.17535431,392689.403657878 4766181.32085826,392713.430686312 4766241.59788973,392733.770582058 4766291.44559567,392784.227988722 4766409.63894817,392801.962425686 4766449.39949153,392845.77419309 4766544.27416578,392869.231193602 4766593.37496119,392938.307999832 4766731.08544341,392967.306519928 4766786.22072456,392997.912807626 4766843.28684566,393004.493362132 4766855.32153492,393029.577366964 4766900.50007625,393040.605305795 4766920.06354304,393090.231340693 4767005.60992299,393105.250118202 4767030.77754583,393152.225037701 4767109.35619045,393241.793647845 4767252.25142963,393263.767483809 4767285.71872777,393305.657204749 4767349.62920309,393438.26442405 4767539.69845041,393472.363661036 4767585.67558693,393533.330253841 4767665.75336266,393542.171318237 4767677.06762431,393573.414697758 4767717.07094982,393622.265226875 4767778.37037511,393646.005600548 4767807.56903367,393681.669124945 4767850.80966739,393713.157744093 4767888.44802707,393737.060429019 4767917.14588872,393785.200151486 4767975.86794648,393840.961059247 4768044.09751306,393860.610340005 4768067.95188793,393890.429405535 4768103.86881484,393905.423707781 4768122.23901801,393928.574566992 4768150.5974695,393964.022490758 4768196.79181551,393982.740862307 4768220.79459121)"

comment:3 by jef, 9 years ago

Version: 2.0.x2.1.x

A more recent and example using simpler geometry - a segment of the offset line is missing and turns it into a multiline string:

qgis=> select st_astext( st_offsetcurve( st_geomfromtext( 'LINESTRING(436533.041 5755061.11,436420.979 5755061.071,436372.505 5755061.054,436346.382 5755061.045)' ), -0.17 ) );
st_astext
-------------------------------------------------------------------------------------------------------------------------------------------------------------
MULTILINESTRING((436420.97894038 5755061.24099999,436533.040940836 5755061.27999999),(436346.381941431 5755061.21499999,436372.504941431 5755061.22399999))
(1 row)
 
qgis=> select postgis_full_version();
NOTICE: Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?
postgis_full_version
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
POSTGIS="2.1.3 r12547" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="UNKNOWN" (core procs from "2.1.2 r12389" need upgrade) RASTER (raster procs from "2.1.2 r12389" need upgrade)
(1 row)

comment:4 by jef, 9 years ago

Cc: jef added

comment:5 by mdavis, 3 months ago

Now fixed:

select st_astext( st_offsetcurve( st_geomfromtext( 'LINESTRING(436533.041 5755061.11,436420.979 5755061.071,436372.505 5755061.054,436346.382 5755061.045)' ), -0.17 ) );
                                                                         st_astext                                                                          
------------------------------------------------------------------------------------------------------------------------------------------------------------
 LINESTRING(436533.04094083636 5755061.27999999,436420.9789403804 5755061.24099999,436372.50494143093 5755061.223999989,436346.3819414309 5755061.21499999)

comment:6 by mdavis, 3 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.