Opened 8 years ago
Last modified 6 years ago
#3061 new defect
"Export vector data as multi-features" leads to crash
Reported by: | neo | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.7 |
Component: | Vector | Version: | unspecified |
Keywords: | v.out.ogr, multifeatures | Cc: | |
CPU: | x86-64 | Platform: | MSWindows 7 |
Description
I run the following commands which lead to a crash of GRASS on the shapefile that I attached:
v.in.ogr input=/input/Clusters_Borders.shp layer=Clusters_Borders output=Clusters_Borders v.clean input=Clusters_Borders output=tempA --o tool=rmarea thresh=0.001 v.clean input=tempA output=tempB --o tool=snap thresh=0.001 v.clean input=tempB output=tempA --o tool=break thresh=0.001 v.clean input=tempA output=tempB --o tool=rmdupl thresh=0.001 v.out.ogr -s -m input=tempB@cluster_borders output=/output format=ESRI_Shapefile
The crash does not happen if I leave out the -m parameter on the last command.
The clean commands above are from here: http://gis.stackexchange.com/a/71729
Attachments (1)
Change History (8)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Component: | Default → Vector |
---|---|
Keywords: | v.out.ogr multifeatures added |
by , 8 years ago
Attachment: | screenshot_cluster_borders_subset.jpg added |
---|
Screenshot of a part of the Clusters_Borders.shp map
follow-up: 4 comment:3 by , 8 years ago
In the first place I have some doubts that you can automatically fix these severe topological errors in the map (with the digitizer, yes). See attached screenshot.
Anyway, I checked with the debugger:
gdb v.out.ogr (gdb) r -s -m input=tempB output=~/tmp format=ESRI_Shapefile Exporting 3999 areas (may take some time)... 0% Program received signal SIGSEGV, Segmentation fault. 0x00007ffff79538f7 in Vect_get_area_points (Map=0x7fffffffcce0, area=-1979, BPoints=0xb76460) at area.c:54 54 G_debug(3, " n_lines = %d", Area->n_lines); (gdb) (gdb) bt full #0 0x00007ffff79538f7 in Vect_get_area_points (Map=0x7fffffffcce0, area=-1979, BPoints=0xb76460) at area.c:54 Plus = 0x7fffffffccf0 Area = 0x7bc00000879 #1 0x000000000040445a in create_polygon (In=0x7fffffffcce0, area=-1979, Points=0xb76460) at export_areas.c:294 j = -13088 k = 32767 Ogr_geometry = 0xf9f ring = 0x82a580 #2 0x00000000004040ed in export_areas_multi (In=0x7fffffffcce0, field=1, donocat=0, Ogr_featuredefn=0xb74e30, Ogr_layer=0xb5cef0, Fi=0xb74ac0, driver=0xb752b0, ncol=6, colctype=0xb74fb0, colname=0xb75140, doatt=1, nocat=1, n_noatt=0x7fffffffb34c, n_nocat=0x7fffffffb348) at export_areas.c:193 i = 0 n_exported = 0 area = -1979 cat = 1 ncats_field = 1 line = 8819 type = 32767 findex = 1 ipart = 1 Points = 0xb76460 Cats = 0xb76440 cat_list = 0xb762c0 line_list = 0xb76490 lcats = 0xb764b0 Ogr_geometry = 0xb760a0 Ogr_geometry_part = 0xb75fc0 Ogr_feature = 0x40ab38 wkbtype = wkbMultiPolygon wkbtype_part = wkbPolygon #3 0x0000000000403b92 in export_areas (In=0x7fffffffcce0, field=1, multi=1, donocat=0, Ogr_featuredefn=0xb74e30, Ogr_layer=0xb5cef0, Fi=0xb74ac0, driver=0xb752b0, ncol=6, colctype=0xb74fb0, colname=0xb75140, doatt=1, nocat=1, noatt=0x7fffffffb34c, fout=0x7fffffffb348) at export_areas.c:26 No locals. #4 0x0000000000408137 in main (argc=7, argv=0x7fffffffd5e8) at main.c:737 i = 6 otype = 64 ftype = 0 donocat = 0 num_to_export = 3999 field = 1 overwrite = 1 found = 1 module = 0x7ffff751d7a8 <state+40> options = {input = 0x7ffff751d808 <state+136>, dsn = 0x628860, layer = 0x66cf20, type = 0x6287a0, format = 0x628920, field = 0x6286e0, dsco = 0x66d230, lco = 0x66d2d0, otype = 0x66cfc0} flags = {cat = 0x66d370, esristyle = 0x66d3a0, update = 0x7ffff751d7d8 <state+88>, nocat = 0x66c250, new = 0x66d430, append = 0x66cc70, force2d = 0x66d3d0, multi = 0x66d400} buf = "HTTP\000\060\000S\000arch\000\000\000\220\313\371\367\377\177\000\000H\265\371\367\377\177\000\000\340\325\377\377\377\177\000\000@\003\000\000\000\000\000\000\177ELF\002\001\001\000\000\000\000\000\000\000\000\000\003\000>\000\001\000\000\000P\v\000\000\000\000\000\000@\000\000\000\000\000\000\000\020%\000\000\000\000\000\000\000\000\000\000@\000\070\000\a\000@\000\034\000\033\000\001\000\000\000\005", '\000' <repeats 27 times>, "\024\025\000\000\000\000\000\000\024\025\000\000\000\000\000\000\000\000 \000\000\000\000\000\001\000\000\000\006\000\000\000\250\035\000\000\000\000\000\000\250\035 \000\000\000\000\000\250\035 \000\000\000\000\000"... key1 = "cat\000\377\177\000\000\000 \372\367\377\177\000\000\020\275\377\377\377\177\000\000\000\000\200y\377\377\377\377\220\304\377\377\377\177\000\000S\224\336\367\377\177\000\000\001\000\000\000\377\177\000\000\240\071\372\367\377\177\000\000@\275\377\377\377\177\000\000\000\000\340y\377\377\377\377\220\304\377\377\377\177\000\000S\224\336\367\377\177\000\000\001\000\000\000\377\177\000\000\320\064\372\367\377\177\000\000p\275\377\377\377\177\000\000\000\000@z\377\377\377\377\220\304\377\377\377\177\000\000S\224\336\367\377\177\000\000\001\000\000\000\377\177\000\000\000\060\372\367\377\177\000\000\240\275\377\377\377\177\000\000\000\000\240z\377\377\377\377\220\304\377\377\377\177\000\000S\224\336\367\377\177\000\000\001\000\000\000\377\177\000\000"... key2 = "lat\000\000ers_c\000\367\377\177\000\000\001\000\000\000\377\177\000\000\000\020\373\367\377\177\000\000\360\304\377\377\377\177\000\000\000\000@\211\377\377\377\377\220\321\377\377\377\177\000\000S\224\336\367\377\177\000\000\001\000\000\000\377\177\000\000\310)\373\367\377\177\000\000 \305\377\377\377\177\000\000\000\000\240\211\377\377\377\377\220\321\377\377\377\177\000\000S\224\336\367\377\177\000\000\001\000\000\000\377\177\000\000\350$\373\367\377\177\000\000P\305\377\377\377\177\000\000\000\000\000\212\377\377\377\377\220\321\377\377\377\177\000\000S\224\336\367\377\177\000\000\001\000\000\000\377\177\000\000\000 \373\367\377\177\000\000\200\305\377\377\377\177\000\000\000\000`\212\377\377\377\377\220\321\377\377\377\177\000\000"... cellhd = {format = 0, compressed = -1, rows = 1, rows3 = 1, cols = 1, cols3 = 1, depths = 1, proj = 99, zone = 0, ew_res = 1, ew_res3 = 1, ns_res = 1, ns_res3 = 1, tb_res = 1, north = 1, south = 0, east = 1, west = 0, top = 1, bottom = 0} tokens = 0x7fffe22b60b0 In = {format = 0, temporary = 0, dblnk = 0xa13f40, plus = {version = {topo = {major = 5, minor = 1, back_major = 5, back_minor = 1}, spidx = {major = 5, minor = 1, back_major = 5, back_minor = 1}, cidx = {major = 5, minor = 0, back_major = 5, back_minor = 0}}, with_z = 0, spidx_with_z = 0, off_t_size = 4, head_size = 142, spidx_head_size = 113, cidx_head_size = 9, release_support = 0, port = {byte_order = 0, off_t_size = 0, dbl_cnvrt = "\000\001\002\003\004\005\006\a", flt_cnvrt = "\000\001\002\003", lng_cnvrt = "\000\001\002\003", int_cnvrt = "\000\001\002\003", shrt_cnvrt = "\000\001", off_t_cnvrt = "\000\001\002\003\004\005\006\a", dbl_quick = 1, flt_quick = 1, lng_quick = 1, int_quick = 1, shrt_quick = 1, off_t_quick = 1}, spidx_port = {byte_order = 0, off_t_size = 4, dbl_cnvrt = "\000\001\002\003\004\005\006\a", flt_cnvrt = "\000\001\002\003", lng_cnvrt = "\000\001\002\003", int_cnvrt = "\000\001\002\003", shrt_cnvrt = "\000\001", off_t_cnvrt = "\000\001\002\003\004\005\006\a", dbl_quick = 1, flt_quick = 1, lng_quick = 1, int_quick = 1, shrt_quick = 1, off_t_quick = 1}, cidx_port = {byte_order = 0, off_t_size = 0, dbl_cnvrt = "\000\001\002\003\004\005\006\a", flt_cnvrt = "\000\001\002\003", lng_cnvrt = "\000\001\002\003", int_cnvrt = "\000\001\002\003", shrt_cnvrt = "\000\001", off_t_cnvrt = "\000\001\002\003\004\005\006\a", dbl_quick = 1, flt_quick = 1, lng_quick = 1, int_quick = 1, shrt_quick = 1, off_t_quick = 1}, mode = 0, built = 4, box = { N = 5415981.7036623769, S = -377147.33264612779, E = 7316584.6849710029, W = 2020203.1128580575, T = 0, B = 0}, Node = 0x672180, Line = 0x785040, Area = 0x87cd60, Isle = 0x8fc230, n_plines = 0, n_llines = 0, n_blines = 9636, n_clines = 4462, n_flines = 0, n_klines = 0, n_vfaces = 0, n_hfaces = 0, n_nodes = 7914, n_edges = 0, n_lines = 14098, n_areas = 3999, n_isles = 2269, n_faces = 0, n_volumes = 0, n_holes = 0, alloc_nodes = 7914, alloc_edges = 0, alloc_lines = 14098, alloc_areas = 3999, alloc_isles = 2269, alloc_faces = 0, alloc_volumes = 0, alloc_holes = 0, Node_offset = 142, Edge_offset = 0, Line_offset = 312598, Area_offset = 555112, Isle_offset = 668908, Volume_offset = 0, Hole_offset = 0, Spidx_built = 1, Spidx_new = 0, Spidx_file = 1, spidx_fp = {file = 0x924290, start = 0x0, current = 0x0, end = 0x0, size = 0, alloc = 0, loaded = 0}, Node_spidx_offset = 671749, Line_spidx_offset = 1876029, Area_spidx_offset = 2224937, Isle_spidx_offset = 2424857, Face_spidx_offset = 0, Volume_spidx_offset = 0, Hole_spidx_offset = 0, Node_spidx = 0x66e0f0, Line_spidx = 0x99a850, Area_spidx = 0xa13d30, Isle_spidx = 0xa8d210, Face_spidx = 0x0, Volume_spidx = 0x0, Hole_spidx = 0x0, update_cidx = 0, n_cidx = 3, a_cidx = 5, cidx = 0x6717b0, cidx_up_to_date = 1, coor_size = 3142923, coor_mtime = 0, uplist = {do_uplist = 0, uplines = 0x0, uplines_offset = 0x0, alloc_uplines = 0, n_uplines = 0, upnodes = 0x0, alloc_upnodes = 0, n_upnodes = 0}}, open = 1428335138, mode = 0, level = 2, head_only = 0, support_updated = 0, name = 0x6719a0 "tempB", mapset = 0x671af0 "user1", location = 0x671b10 "eu_laea", gisdbase = 0x671b30 "/home/neteler/grassdata", next_line = 1, constraint = {region_flag = 0, box = {N = 0, S = 0, E = 0, W = 0, T = 0, B = 0}, type_flag = 0, type = 0, field_flag = 0, field = 0}, proj = 0, hist_fp = 0xb309d0, dgraph = {line_type = 0, graph_s = {iErrno = 0, Version = 0 '\000', Endian = 0 '\000', NodeAttrSize = 0, EdgeAttrSize = 0, aOpaqueSet = {0 <repeats 16 times>}, cNode = 0, cHead = 0, cTail = 0, cAlone = 0, cEdge = 0, nnCost = 0, Flags = 0, nFamily = 0, nOptions = 0, pNodeTree = 0x0, pEdgeTree = 0x0, pNodeBuffer = 0x0, iNodeBuffer = 0, pEdgeBuffer = 0x0, iEdgeBuffer = 0, edgePrioritizer = {cEdge = 0, iEdge = 0, pEdgePri32Item = 0x0, pvAVL = 0x0}, nodePrioritizer = {pvAVL = 0x0}}, spCache = {nStartNode = 0, NodeHeap = {index = 0, count = 0, block = 0, pnode = 0x0}, pvVisited = 0x0, pvPredist = 0x0}, edge_fcosts = 0x0, edge_bcosts = 0x0, node_costs = 0x0, cost_multip = 0}, head = {organization = 0x671b50 "", date = 0x671b70 "", user_name = 0x671b90 "neteler", map_name = 0x671bb0 "", source_date = 0x671a80 "Sun Jun 12 12:06:43 2016", orig_scale = 1, comment = 0x671bd0 "", proj = 99, plani_zone = 0, digit_thresh = 0, coor_version = {major = 5, minor = 1, back_major = 5, back_minor = 1}, with_z = 0, size = 3142923, head_size = 18, port = {byte_order = 0, off_t_size = 0, dbl_cnvrt = "\000\001\002\003\004\005\006\a", flt_cnvrt = "\000\001\002\003", lng_cnvrt = "\000\001\002\003", int_cnvrt = "\000\001\002\003", shrt_cnvrt = "\000\001", off_t_cnvrt = "\000\001\002\003\004\005\006\a", dbl_quick = 1, flt_quick = 1, lng_quick = 1, int_quick = 1, shrt_quick = 1, off_t_quick = 1}, last_offset = 2669508, recycle = 0x0}, dig_fp = {file = 0xb307a0, start = 0x0, current = 0x0, end = 0x0, size = 0, alloc = 0, loaded = 0}, fInfo = {i = 0, ogr = { driver_name = 0x0, dsn = 0x0, layer_name = 0x0, driver = 0x0, ds = 0x0, layer = 0x0, dbdriver = 0x0, dsn_options = 0x0, layer_options = 0x0, cache = {lines = 0x0, lines_types = 0x0, lines_cats = 0x0, lines_alloc = 0, lines_num = 0, lines_next = 0, fid = 0, sf_type = SF_GEOMETRY, ctype = 0}, feature_cache = 0x0, offset = {array = 0x0, array_num = 0, array_alloc = 0}, next_line = 0}, pg = {conninfo = 0x0, db_name = 0x0, schema_name = 0x0, table_name = 0x0, fid_column = 0x0, geom_column = 0x0, feature_type = SF_GEOMETRY, coor_dim = 0, srid = 0, dbdriver = 0x0, fi = 0x0, inTransaction = 0, conn = 0x0, res = 0x0, cursor_name = 0x0, cursor_fid = 0, next_line = 0, cache = {lines = 0x0, lines_types = 0x0, lines_cats = 0x0, lines_alloc = 0, lines_num = 0, lines_next = 0, fid = 0, sf_type = SF_GEOMETRY, ctype = 0}, offset = {array = 0x0, array_num = 0, array_alloc = 0}, topogeom_column = 0x0, toposchema_name = 0x0, toposchema_id = 0, topo_geo_only = 0}}, site_att = 0x0, n_site_att = 0, n_site_dbl = 0, n_site_str = 0} doatt = 1 ncol = 6 colsqltype = 3 colwidth = 20 keycol = 0 colctype = 0xb74fb0 colname = 0xb75140 Fi = 0xb74ac0 Driver = 0xb752b0 Table = 0xb74c30 dbstring = {string = 0xb73940 "tempB", nalloc = 6} Column = 0xb75e00 n_feat = 0 n_nocat = 0 n_noatt = 0 drn = 4 ogr_ftype = OFTInteger Ogr_ds = 0xb330c0 Ogr_driver = 0x6529d0 Ogr_layer = 0xb5cef0 Ogr_field = 0xb760a0 Ogr_featuredefn = 0xb74e30 wkbtype = wkbMultiPolygon Ogr_projection = 0xb31080 papszDSCO = 0x0 papszLCO = 0x0 num_types = 1 (gdb)
So, reproducible but I am not quite sure what's wrong (out of my expertise).
comment:4 by , 8 years ago
Replying to neteler:
In the first place I have some doubts that you can automatically fix these severe topological errors in the map (with the digitizer, yes). See attached screenshot.
Anyway, I checked with the debugger:
gdb v.out.ogr (gdb) r -s -m input=tempB output=~/tmp format=ESRI_Shapefile Exporting 3999 areas (may take some time)... 0% Program received signal SIGSEGV, Segmentation fault. 0x00007ffff79538f7 in Vect_get_area_points (Map=0x7fffffffcce0, area=-1979, BPoints=0xb76460) at area.c:54 54 G_debug(3, " n_lines = %d", Area->n_lines); (gdb) (gdb) bt full #0 0x00007ffff79538f7 in Vect_get_area_points (Map=0x7fffffffcce0, area=-1979, BPoints=0xb76460) at area.c:54 Plus = 0x7fffffffccf0 Area = 0x7bc00000879 #1 0x000000000040445a in create_polygon (In=0x7fffffffcce0, area=-1979, Points=0xb76460) at export_areas.c:294
Area ID is negative: more than one centroid in this area. With negative area ID, Vect_get_area_points() will fail with segfault. The fix is to add a check to v.out.ogr for such cases. That avoids the segfault.
The main problem, however, is that cleaning did not succeed. Apparently, a last step with v.clean tool=rmdac is needed. After each run of v.clean, the output messages should be read carefully in order to decide if the output vector is sufficiently clean.
comment:5 by , 8 years ago
Milestone: | 7.0.5 → 7.0.6 |
---|
comment:6 by , 7 years ago
Milestone: | 7.0.6 → 7.0.7 |
---|
The shapefile is too big for an attachment, so here it is instead: https://www.dropbox.com/s/ahy2t2ndk5xmebh/cluster_borders.zip