[mapserver-users] Segfault - LINE layer
Rahkonen Jukka (MML)
jukka.rahkonen at maanmittauslaitos.fi
Mon Aug 21 00:28:20 PDT 2017
Hi,
Agreed, it shouldn't segfault, but I do not quite understand how these empty geometries ever get selected. It is PostGIS backend and WMS GetMap request. As far as I know Mapserver in this case adds the "&&" or "bounding boxes intersect" query to the main query by using the layer extent as reference. As far as I know the only way to prevent this is to set metadata item "wfs_use_default_extent_for_getfeature" to false as documented in http://mapserver.org/ogc/wfs_server.html and even then this only affects WFS service.
I made a test with PostGIS by interting two geometries into a table:
POLYGON (( 40 40, 40 120, 120 120, 120 40, 40 40 ))
LINESTRING EMPTY
Query
select * from bbox_test
where "GEOMETRY" && ST_GeomFromText('POLYGON (( 40 40, 40 120, 120 120, 120 40, 40 40 ))');
does not return the empty geometry.
I believe that Dave has something not typical in his environment. As he said, OSM data tend to have empty geometries but for most users rendering OS data still works. What have given problems for me are not empty geometries but invalid ones, typically polygons with only three vertices A-B-A.
Dave, please add DEBUG 5 into your layer. It should then log the exact SQL that Mapserver is generating. Check if the && part is added into the query and if it is run the same query diretly with pgAdmin and see if the empty geometries are really selected.
-Jukka Rahkonen-
________________________________
Lähettäjä: mapserver-users <mapserver-users-bounces at lists.osgeo.org> käyttäjän puolestaLime, Steve D (MNIT) <steve.lime at state.mn.us>
Lähetetty: 18. elokuuta 2017 23:45
Vastaanottaja: Andrea Peri
Kopio: Dave Barter; mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] Segfault - LINE layer
agreed, shouldn't segfault in either case
________________________________
From: Andrea Peri <aperi2007 at gmail.com>
Sent: Friday, August 18, 2017 2:22:15 PM
To: Lime, Steve D (MNIT)
Cc: Dave Barter; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Segfault - LINE layer
Hi, I guess the avoid of empty or null geometries should happened surely in wms service.
Not sure It is good in wfs services.
A.
Il 18 Ago 2017 17:19, "Lime, Steve D (MNIT)" <steve.lime at state.mn.us<mailto:steve.lime at state.mn.us>> ha scritto:
Still it the code should gracefully skip empty geometries. Can you create a ticket please?
From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org>] On Behalf Of Dave Barter
Sent: Friday, August 18, 2017 9:56 AM
To: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Subject: Re: [mapserver-users] Segfault - LINE layer
As a quick workaround edit your DATA:
where type in ('trunk','motorway','primary') AND geometry is not null
-Jukka Rahkonen-
That will not work as an empty geometry is not null
The fix is WHERE NOT ST_EMPTY(geometry)
Lähettäjä: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta Dave Barter
Lähetetty: 18. elokuuta 2017 16:05
Vastaanottaja: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Aihe: Re: [mapserver-users] Segfault - LINE layer
On 18 Aug 2017, at 13:44, Lime, Steve D (MNIT) <steve.lime at state.mn.us<mailto:steve.lime at state.mn.us>> wrote:
I'd call it a bug. What version? Can you prepare a small test case?
MapServer version 7.0.4 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
I have tracked it down to a specific geometry:-
010200000000000000 = ‘LINESTRING EMPTY’
________________________________
From: mapserver-users <mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org>> on behalf of Dave Barter <dave at phased.co.uk<mailto:dave at phased.co.uk>>
Sent: Friday, August 18, 2017 5:13:29 AM
To: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Subject: [mapserver-users] Segfault - LINE layer
This call:-
/usr/lib/cgi-bin/mapserv.ngx -nh "QUERY_STRING=map=/usr/src/app/mapfiles/api/wms_osm_google_world_bw.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&STYLES=&BBOX=-6114.962263%2c6099063.360931%2c162657.996191%2c6267836.319384&WIDTH=276&HEIGHT=276&FORMAT=image%2fpng&SRS=EPSG%3a3857&LAYERS=roads8&transparent=false
Is giving me:-
Segmentation fault (core dumped)
For the layer definition:-
LAYER
GROUP "default"
STATUS ON
TYPE LINE
MINSCALEDENOM 1300032
MAXSCALEDENOM 2600064
NAME "roads8"
DEBUG 5
CONNECTIONTYPE postgis
PROCESSING "CLOSE_CONNECTION=DEFER"
{%public_map_user%}
PROJECTION
"init=epsg:900913"
END
DATA "geometry from (select osm_id,geometry,name as name,ref,type from mapping_osm.osm_new_roads_gen1 where type in ('trunk','motorway','primary') order by z_order asc) as foo using unique osm_id using srid=900913"
LABELITEM "name"
CLASSITEM "type"
CLASS
EXPRESSION {primary,primary_link}
STYLE
WIDTH 0.5
COLOR 242 242 242
END
END
CLASS
EXPRESSION "motorway"
TEXT ("[ref]")
STYLE
WIDTH 1
OUTLINEWIDTH 0.5
OUTLINECOLOR 217 217 217
END
STYLE
WIDTH 1
COLOR 242 242 242
END
END
CLASS
EXPRESSION "trunk"
TEXT ("[ref]")
STYLE
WIDTH 1
OUTLINEWIDTH 0.5
OUTLINECOLOR 217 217 217
END
STYLE
WIDTH 1
COLOR 242 242 242
END
END
END
When I look in my debug file I see the following as last set of lines:-
[Fri Aug 18 11:09:39 2017].945225 msPostGISReadShape: PQgetlength = 7
[Fri Aug 18 11:09:39 2017].945236 msPostGISReadShape: [type] "primary"
[Fri Aug 18 11:09:39 2017].945248 msPostGISReadShape: PQgetlength = 0
[Fri Aug 18 11:09:39 2017].945259 msPostGISReadShape: [name] ""
[Fri Aug 18 11:09:39 2017].945270 msPostGISReadShape: PQgetlength = 0
[Fri Aug 18 11:09:39 2017].945281 msPostGISReadShape: [ref] ""
[Fri Aug 18 11:09:39 2017].945292 msPostGISReadShape: Setting shape->index = 307691570
[Fri Aug 18 11:09:39 2017].945303 msPostGISReadShape: Setting shape->resultindex = 327
[Fri Aug 18 11:09:39 2017].945314 msPostGISReadShape: [index] 307691570
[Fri Aug 18 11:09:39 2017].945346 msPostGISReadShape: [shape] LINESTRING (139231.1053743003285490 6233477.4797634640708566, 139274.7760105324559845 6233447.9814142314717174)
[Fri Aug 18 11:09:39 2017].945369 msPostGISLayerNextShape called.
[Fri Aug 18 11:09:39 2017].945383 msPostGISReadShape called.
[Fri Aug 18 11:09:39 2017].94
So it seems to segfault during msPostGISReadShape.
I’ve checked the query and it is pulling 3110 linestrings from the database.
But I am not sure why is is segfaulting? Is this a bug?
Dave Barter
dave at phased.co.uk<mailto:dave at phased.co.uk>
@citizenfishy
www.phased.co.uk<http://www.phased.co.uk/>
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20170821/1bc541c1/attachment.htm>
More information about the MapServer-users
mailing list