-
Notifications
You must be signed in to change notification settings - Fork 0
Add ability to import OSM XML directly #15
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { OsmApiClient, OsmApiClientError, osm2osc } from '~/services/osm'; | |
| import { openTdeiPathwaysArchive, pathways2osc } from '~/services/pathways'; | ||
| import { TdeiClient, TdeiClientError, TdeiConversionError } from '~/services/tdei'; | ||
| import { WorkspacesClient, WorkspacesClientError } from '~/services/workspaces'; | ||
| import { isMimeXml } from '~/util/xml'; | ||
|
|
||
| const status = { | ||
| idle: 'Idle', | ||
|
|
@@ -62,7 +63,7 @@ export class FileImporter { | |
| } | ||
|
|
||
| async _run(data: Blob, workspace): Promise<number> { | ||
| if (workspace.type === 'osw') { | ||
| if (workspace.type === 'osw' && !isMimeXml(data.type)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add a check for the mime type of a .zip file and display an error if the file is neither .zip or .xml vs. assuming anything not .xml is .zip?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that makes sense. Originally, this was "feed anything through to the converter, and let it complain if it doesn't support it", but it looks like the converter API's error messages are not helpful at all.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LMK if you wanna connect on wrapping this up!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (when you get back!) |
||
| this._context.status = status.convertOsm; | ||
| data = await this._tdeiClient.convertDataset(data, 'osw', 'osm', workspace.tdeiProjectGroupId); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No .osm?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .osm extension is a little messy—OSM publishes the official planet file with the .osm extension, but other tools like JOSM may use the extension for both OSM XML and for changeset diffs (instead of .osc). We would need to peek the file to determine how to process it.
Though, I suppose the same issue exists with the .xml extension. Maybe we should shelve this until we have time to write out the validation logic.