Changeset 34997 in osm


Ignore:
Timestamp:
2019-05-05T20:27:25+02:00 (5 years ago)
Author:
donvip
Message:

fix #josm17529 - fix shapefile reading regression (patch by openbrian)

Location:
applications/editors/josm/plugins/opendata
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java

    r34911 r34997  
    155155                Geometry g = gc.getGeometryN(i);
    156156                if (g instanceof Polygon) {
     157                    // TODO: Split this section between Polygon and MultiPolygon.
    157158                    Relation r = (Relation) op;
    158159                    Polygon p = (Polygon) g;
     
    170171                        }
    171172                    }
     173                    op = r != null ? r : w;
    172174                } else if (g instanceof LineString) {
    173175                    op = createOrGetWay((LineString) g);
  • applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReaderTest.java

    r34911 r34997  
    104104        }
    105105    }
     106
     107    /**
     108     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/17529">#17529</a>
     109     * @throws Exception if an error occurs during reading
     110     */
     111    @Test
     112    public void testTicket17529() throws Exception {
     113        // There is only 1 feature in this data set.
     114        File file = new File(TestUtils.getRegressionDataFile(17529, "west_webmerc.shp"));
     115        try (InputStream is = new FileInputStream(file)) {
     116            Collection<Way> ways = ShpReader.parseDataSet(is, file, null, null).getWays();
     117            assertFalse(ways.isEmpty());
     118            Way way = ways.iterator().next();
     119            assertEquals("Westminster city", way.get("NAMELSAD"));
     120        }
     121    }
    106122}
Note: See TracChangeset for help on using the changeset viewer.