Opened 9 years ago
Closed 6 years ago
#13843 closed defect (fixed)
Not properly loading attributes from multipart objects
Reported by: | naoliv | Owned by: | openbrian |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin opendata | Version: | |
Keywords: | Cc: |
Description
The attached example shapefile has a multipart object (two lines) with name=Test
When opening it in JOSM, however, we can see name=Test
only in one way, with the other having no tags at all.
Shouldn't all ways have the same properties/tags when importing multipart objects like this?
URL:http://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2016-10-22 12:33:10 +0200 (Sat, 22 Oct 2016) Build-Date:2016-10-23 01:37:31 Revision:11154 Relative:URL: ^/trunk Identification: JOSM/1.5 (11154 pt_BR) Linux Debian GNU/Linux unstable (sid) Memory Usage: 249 MB / 4029 MB (82 MB allocated, but free) Java version: 1.8.0_111-8u111-b14-2-b14, Oracle Corporation, OpenJDK 64-Bit Server VM Screen: :0.0 1920x1080 Maximum Screen Size: 1920x1080 Java package: openjdk-8-jre:amd64-8u111-b14-2 Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-9 VM arguments: [-Dawt.useSystemAAFontSettings=on] Dataset consistency test: No problems found Plugins: + AddrInterpolation (32699) + Create_grid_of_ways (32699) + FastDraw (32938) + FixAddresses (32796) + ImportImagePlugin (32699) + OpeningHoursEditor (32699) + PicLayer (32796) + SimplifyArea (32796) + apache-commons (32699) + buildings_tools (32944) + download_along (32946) + editgpx (32699) + ejml (32680) + geojson (43) + geotools (32813) + graphview (32796) + jogl (1.0.46) + jts (32699) + kendzi3d (1.0.191) + kendzi3d-resources (0.0.1) + log4j (32699) + measurement (32936) + merge-overlap (32699) + opendata (32898) + pdfimport (32796) + photo_geotagging (32699) + poly (32699) + reverter (32796) + tageditor (33021) + tagging-preset-tester (32869) + todo (30000) + turnlanes-tagging (252) + turnrestrictions (32796) + undelete (32699) + utilsplugin2 (32815)
Attachments (4)
Change History (23)
by , 9 years ago
Attachment: | test.tar.gz added |
---|
comment:1 by , 9 years ago
Summary: | Not properly opening shapefiles with multiparts → Not properly loading attributes from multipart objects |
---|
comment:2 by , 9 years ago
comment:3 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
comment:4 by , 8 years ago
Resolution: | → needinfo |
---|---|
Status: | needinfo → closed |
comment:5 by , 6 years ago
Resolution: | needinfo |
---|---|
Status: | closed → reopened |
I ran into this issue too. Using QGIS, I can see that a feature is a geometry collection of linestrings. When I use the OpenData plugin to open this data in JOSM, I see the non-geometry attributes are lost from some OSM ways.
I did a scan of the code (https://github.com/openstreetmap/josm-plugins/blob/master/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java#L149) and I think I see why.
"w" is assigned one part of the geometry. The next item (line 132) will clobber "w". The primitive is only assigned the last geometry item (line 157). And the attributes are only assigned to this feature (line 172).
I can take a stab at fixing this, but I need instructions on how to compile the plugin (standalone) and install it into my locally installed JOSM. The READMEs (opendata, and josm-plugins) are missing this.
If you have opinions, please let me know how you would like this solved. Looks like polygons have this issue too. Not sure I'll solve that issue. If possible, I'd like to start by creating an automated test for this in ShpReaderTest.java.
Also, has what's the official repo for the plugin: svn or github? Github repo says it's a mirror. svn.osm.org says "NOTICE: Please note that this OpenStreetMap svn repo is deprecated and many items have now moved to repositories under the github.com/OpenStreetMap project."
comment:6 by , 6 years ago
Hi Brian,
Thanks for your preliminary analysis!
The official repository for plugins is the OSM SVN. We plan to switch from it to eventually one git repository per plugin, but we're not there yet.
To compile and install the plugin you can do as follows (see DevelopersGuide/DevelopingPlugins#Settinguptheenvironment for details):
svn co https://svn.openstreetmap.org/applications/editors/josm
cd plugins/opendata
ant clean install
I would be happy to apply your future patch, let me know if you have other questions :)
A test case would be nice too, to ensure non-regression.
Other interesting targets:
ant test
ant checkstyle
ant spotbugs
comment:7 by , 6 years ago
I made a github repo for josm-opendata and created a branch to fix this issue. Please review the PR (branch against master) here.
https://github.com/openbrian/josm-opendata/pull/1
I did this in several commits so you can see how the code changed.
(Notice on master, there's one other small change. I just renamed a variable.)
comment:8 by , 6 years ago
It looks nice :) Can you please add a test? Then I'll apply the patch and make a new release.
by , 6 years ago
Attachment: | patch_13843.diff added |
---|
patch to copy attribs to all parts of a multipart feature.
comment:10 by , 6 years ago
The patch doesn't apply nicely. Are you up to date with the current SVN code base?
comment:11 by , 6 years ago
Sorry about that. I overlayed a git repo on top of the opendata folder. I did my work in a branch and generated the patch using "git diff master". Here's one using "svn diff".
by , 6 years ago
Attachment: | patch_13843_svn.diff added |
---|
same patch but generated using svn instead of git.
comment:12 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in [o34898:34900]. Thanks!
comment:14 by , 6 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
@openbrian I have fixed the NPE in [o34907] but it doesn't fix the test. Can you please take a look?
comment:15 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
by , 6 years ago
Attachment: | 13843_fix_zip_reader_test.diff added |
---|
Fix a failing automated test for ZipReader
what kind of object is that? If I remember correctly, the plugin assembles all parts into a single OSM way, but in this case the segments are discontinued. Is the geometry valid?