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

Support importing osmChange and geojson files #10407

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

k-yle
Copy link
Collaborator

@k-yle k-yle commented Aug 12, 2024

Closes #7109, Closes #8036

This PR adds a new button which allows you to import an osmChange file into the editor. Preview it here.

This PR is cherrypicked from my fork of iD, so it also supports importing a geojson/osmPatch file. Presumably these features would be removed if this PR were to be accepted. But I wanted to make a PR so there's a place for discussion.

Based on my use cases, the main benefits are:

  • you can backup and restore your changes from iD
  • you can start an edit on your phone using OsmAnd / EveryDoor, and continue it in iD
  • you can use a tool like osm-revert and then tidy up the revert in iD before uploading it1
  • the feature to import a geojson/osmPatch file is what I use for many import projects
  • (niche use case) during long editing sessions, if iD gets too slow, you can export your changes, reload the page, discard your edits, and re-import the osmChange file.

Footnotes

  1. this is still quite buggy

@k-yle k-yle added the new-feature A new feature for iD label Aug 12, 2024
@dabreegster
Copy link

Super awesome timing, I was just looking for something like this. I've got a few tools in progress that help find/fix tagging problems. The focus of those tools doesn't include checking tags of nearby objects, having a list of edited objects, uploading changesets, etc, and I don't want to reinvent parts of iD. So this feature will be perfect, thanks for implementing it!

I tried out your demo with an example (sample edit, don't actually upload it):

<osmChange version="0.6" generator="osm2streets">
<create/>
<modify>
<way id="436794680" version="12">
  <nd ref="4346605157"/>
  <nd ref="2860653272"/>
  <nd ref="5707494413"/>
  <nd ref="2860653268"/>
  <nd ref="2941419917"/>
  <tag k="cycleway:right" v="lane"/>
  <tag k="cycleway:right:lane" v="exclusive"/>
  <tag k="highway" v="secondary"/>
  <tag k="lanes" v="3"/>
  <tag k="lit" v="yes"/>
  <tag k="maxspeed" v="35 mph"/>
  <tag k="maxspeed:type" v="sign"/>
  <tag k="name" v="East University Drive"/>
  <tag k="oneway" v="yes"/>
  <tag k="smoothness" v="good"/>
  <tag k="surface" v="asphalt"/>
  <tag k="turn:lanes" v="||right"/>
</way>
</modify>
</osmChange>

but I just got "Failed to import file" at the bottom with no further details in the console or elsewhere. I'd suggest:

  1. Opening a modal to display this error; the status at the bottom is tiny and disappeared quickly
  2. Surfacing some info on what went wrong

@k-yle
Copy link
Collaborator Author

k-yle commented Aug 13, 2024

thanks for the feedback @dabreegster :) I've added an error modal, and the errors are now logged to the console

In your case, it's because of a conflict, the xml has version="12" but v13 is the latest (published 5 months ago)

@tordans
Copy link
Collaborator

tordans commented Aug 14, 2024

I think adding this is a great enhancement for advanced use cases!

The only reason I can see not to add it is if it would create too much additional maintenance burden or technical debt. However, we haven't really discussed this aspect for other features… :-).

On the UI side:

This PR adds a new button which allows you to import an osmChange file into the editor. Preview it here.

I am thinking more in the direction of the custom image overlay which has two feautres…

  1. a may to toggle the layer on, which think is useful
  2. a link to a modal that explains the feature

Actually, isn't that more or less the same as …?

image

(Sorry, German UI)

  • the feature to import a geojson/osmPatch file is what I use for many import projects

I really like this use case, but I am not sure if we want to open up this area of features for iD. In my mind, all those import use cases are the domain of Rapid which has more feature in this area. There is facebook/Rapid#585 which touches on some use cases that could use this feature. — There is more to talk about here which we will not resolve in this PR IMO. But I think adding a focus on just re-uploading saved OSM changes session would make this PR easier to handle.

@tordans
Copy link
Collaborator

tordans commented Aug 14, 2024

@dabreegster This is off topic here, but FYI:

Super awesome timing, I was just looking for something like this. I've got a few tools in progress that help find/fix tagging problems. The focus of those tools doesn't include checking tags of nearby objects, having a list of edited objects, uploading changesets, etc, and I don't want to reinvent parts of iD. So this feature will be perfect, thanks for implementing it!

The fix-and-improve-tagging workflow that I am working on in for https://radverkehrsatlas.de/ is to have some place (our backend) create the issues as a geojson endpoint. Then setup a MapRoulette Challenge which gives room for explanation and guidance. And then – for some types of challenges – add "fix tag" attributes that allow a one click modification in MapRoulette. This workflow has become more relevant IMO since Rapid now has a MapRoulette integration. And they might add the "fix tag" challenges as well facebook/Rapid#1340 which would make updating OSM data super easy right inside the editor. — The advantage of adding a raw file like here is IMO, that the process is a lot more guided and allows for more mapper control. Which is always important to prevent accidental miss edits and negative community feedback.

@k-yle
Copy link
Collaborator Author

k-yle commented Aug 14, 2024

the feature to import a geojson/osmPatch file is what I use for many import projects

I really like this use case, but I am not sure if we want to open up this area of features for iD

I agree, I don't think this part should be added to iD itself. It would be too easy for beginners to make an enourmous mess. facebook/Rapid#585 would be the best solution, but the RapiD team were quite hestitant when I asked about it 4 years ago (hence why I built a different fork of RapiD for tag fixes, but now we're getting off topic 😆)


On the UI side:

Your suggestion is possible, althought there would be no checkbox, because you can't "turn off" the data once it's imported. So it would look something like this:
image

A modal with more info is also a good idea. How detailed do you think the explaination should be? The only similar example is this popup, which has very little info and somewhat confusing jargon

@bhousel
Copy link
Member

bhousel commented Aug 14, 2024

facebook/Rapid#585 would be the best solution, but the RapiD team were quite hestitant when I asked about it 4 years ago

That issue is 2 years old, and I don't remember being "hesitant" about it at all.
It's something we want too, but there isn't really a consensus on how to turn custom data into OSM tags yet.
I agree it would be great to add support to Rapid to ingest osmchange files.

@k-yle
Copy link
Collaborator Author

k-yle commented Aug 14, 2024

@bhousel that's great to hear, I think I asked on the OSM US slack back in 2020 and was told that there were no plans to support custom data using the new esri feature. Shall we the continue the import-related discussion in facebook/Rapid#585 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A new feature for iD
Projects
None yet
4 participants