Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msGEOSError(): GEOS library error when using MULTILINESTRING #5529

Closed
gertcuykens opened this issue Dec 2, 2017 · 10 comments · Fixed by #6086
Closed

msGEOSError(): GEOS library error when using MULTILINESTRING #5529

gertcuykens opened this issue Dec 2, 2017 · 10 comments · Fixed by #6086
Assignees
Labels
Milestone

Comments

@gertcuykens
Copy link

gertcuykens commented Dec 2, 2017

msGEOSError(): GEOS library error when using MULTILINESTRING in shapefiles

Try shp2img -m test.map -o test.png -l test -all_debug 5 -s 500 500
on any shapefile that has MULTILINESTRING in it

example shapefile feature and using mapserver 7.0.7

OGRFeature(test):178

  color (String) = #c6b952

  MULTILINESTRING ((1365999.913051389390603
6668002.688304415903986,1365929.670452698832378
6667981.874043367803097),(1366036.091885895933956
6668063.352393131703138,1365999.913051389390603
6668002.688304415903986),(1366004.811108984053135
6668127.219178147614002,1366036.091885895933956
6668063.352393131703138),(1365934.123232331126928
6668138.427049811929464,1366004.811108984053135
6668127.219178147614002),(1365862.878758222097531
6668117.612443232908845,1365934.123232331126928
6668138.427049811929464),(1365792.190881569404155
6668094.485164736397564,1365862.878758222097531
6668117.612443232908845),(1365384.093628322007135
6667942.914158684201539,1365306.949221200309694
6667931.172859975136817),(1365461.460674423491582
6667952.342789551243186,1365384.093628322007135
6667942.914158684201539),(1365538.939040013123304
6667961.771431289613247,1365461.460674423491582
6667952.342789551243186),(1365616.528725096955895
6667969.065293673425913,1365538.939040013123304
6667961.771431289613247),(1365773.266568133374676
6668049.120308448560536,1365760.910104657290503
6668084.344763254746795),(1365771.819414753001183
6668087.724895685911179,1365792.190881569404155
6668094.485164736397564),(1365760.910104657290503
6668084.344763254746795,1365771.819414753001183
6668087.724895685911179),(1365694.786327125271782
6667973.512773931957781,1365616.528725096955895
6667969.065293673425913),(1365773.043929153587669
6667977.426558562554419,1365694.786327125271782
6667973.512773931957781),(1365851.301531179109588
6667980.272948558442295,1365773.043929153587669
6667977.426558562554419),(1365929.670452698832378
6667981.874043367803097,1365851.301531179109588
6667980.272948558442295))
@sdlime
Copy link
Member

sdlime commented Dec 4, 2017

Can you share your test files? --Steve

@sdlime sdlime closed this as completed Dec 4, 2017
@sdlime sdlime reopened this Dec 4, 2017
@gertcuykens
Copy link
Author

gertcuykens commented Dec 4, 2017

@jratike80
Copy link

jratike80 commented Dec 7, 2017

I had a try with MapServer version 7.0.6 (MS4W 3.2.2). Command
shp2img -m trips.map -o test.png -l trips -all_debug 5 -s 500 500
is printing lots of messages "msGEOSError(): GEOS library error. ýçè"
and the result is funny (shp2img.png).

shp2img

EDIT The resulting image from shp2img good because shp2img is using MAP EXTENT and each coloured ball is actually a linestring rendered with unreasonably wide line.

A small BBOX that is read as a WMS layer with OpenJUMP looks better (wms.png)

wms

@gertcuykens
Copy link
Author

gertcuykens commented Dec 7, 2017

Correct render looks good, but it's the error messages that doesn't make sense and will get send to a stderr on a nginx mapserver which is annoying if you want to have some basic monitoring

@jratike80
Copy link

jratike80 commented Dec 7, 2017

This is probably related with #5510. There is also negative offset in your mapfile

    CLASS
      STYLE
        width 8
        color "#000000"
        offset 4 -99

If I edit the offset into 4 99 the GEOS errors disappear. Shp2img creates still an image with points, not with lines.

@gertcuykens
Copy link
Author

gertcuykens commented Dec 7, 2017

Aaa thank you, that i would never found myself :D Ps but it's a bug right? You should be able to use -99 right? as stated in the documentation? If I am not mistaken when using LINESTRING for example with the same map file structure -99 is valid.

@jratike80
Copy link

jratike80 commented Dec 7, 2017

Usage is documented in http://www.mapserver.org/mapfile/style.html

For lines, an OFFSET of y = -99 will produce a line geometry that is shifted x SIZEUNITS perpendicular to the original line geometry. A positive x shifts the line to the right when seen along the direction of the line. A negative x shifts the line to the left when seen along the direction of the line.

If it does not work of if it just writes loads of geos errors into the log I would say that it is a bug.

@jmckenna jmckenna added the Bug label Jun 3, 2020
@jmckenna jmckenna added this to the 7.6.1 Release milestone Jun 3, 2020
@MapServer MapServer deleted a comment from gertcuykens Jun 3, 2020
@jbo-ads
Copy link
Member

jbo-ads commented Jun 4, 2020

I am digging up this issue because a user I know is facing a similar bug. Here is what I've found so far.

Offset lines are computed with GEOS method BufferBuilder::bufferLineSingleSided() which requires a LineString, not a MultiLineString, see code (call sequence is maputil.c:msOffsetPolyline() -> maputil.c:msOffsetCurve() -> mapgeos.c:msGEOSOffsetCurve() -> geos/capi/geos_ts_c.cpp:GEOSOffsetCurve_r() -> src/operation/buffer/BufferBuilder.cpp:BufferBuilder::bufferLineSingleSided()).

I am working on a fix inside mapgeos.c:msGEOSOffsetCurve() which basically consists in splitting a MultilineString into several LineStrings and compute offset on each LineString. Pull request is on the way.

jbo-ads added a commit to jbo-ads/MapServer that referenced this issue Jun 4, 2020
jmckenna added a commit that referenced this issue Jun 4, 2020
Fix issue #5529 about GEOS error with offset on MULTILINESTRING
MapServer-backport-bot pushed a commit to MapServer-backport-bot/MapServer that referenced this issue Jun 4, 2020
@jmckenna jmckenna reopened this Jun 4, 2020
@jmckenna
Copy link
Member

jmckenna commented Jun 4, 2020

I have confirmed @jbo-ads's fix here on Windows, with master & GEOS 3.8.0 The map image is generated, without any "GEOS library error" messages.

Thanks @jbo-ads and @gertcuykens !!

@jmckenna jmckenna closed this as completed Jun 4, 2020
jmckenna added a commit that referenced this issue Jun 4, 2020
…-branch-7-6

[Backport branch-7-6] Fix issue #5529 about GEOS error with offset on MULTILINESTRING
@dkottmann
Copy link

dkottmann commented Sep 13, 2022

this bug still persists with 7.6.4 with:

...
LAYER
  NAME 'belastete_standorte_flaechen'
  ...
  TYPE polygon
  DATA "wkb_geometry FROM (SELECT * FROM <%= @schema %>.belastete_standorte_flaechen ORDER BY t_id) AS t USING UNIQUE t_id USING SRID=<%= @srid %>" 
  MINSCALEDENOM 1.0
  MAXSCALEDENOM 2500001.0
  SYMBOLSCALEDENOM 3000
  CLASSITEM "statusaltlv"
  CLASS
    EXPRESSION "StatusAltlV5"
    STYLE
      OUTLINECOLOR '#F5F5F5'
      WIDTH 1.5
      MINWIDTH 1.2
      MAXWIDTH 70
      OFFSET 0.5 -999
      LINECAP round
      LINEJOIN round
    END   
  ...
  END
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants