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

Custom WMS imagery #6915

Closed
wants to merge 3 commits into from
Closed

Custom WMS imagery #6915

wants to merge 3 commits into from

Conversation

1ec5
Copy link
Collaborator

@1ec5 1ec5 commented Oct 5, 2019

A custom background imagery URL template can now include WMS tokens like {bbox}. A new button in the Custom Background Settings dialog generates a URL template from a WMS GetCapabilities URL.

before

wms

after

The WMS GetCapabilities UI and the logic for converting the GetCapabilities document into a URL template are rather crude for now, and I’m also not wedded to the idea of a separate dialog. Should the Custom Background Settings dialog just accept the GetCapabilities URL in its main text field and asynchronously fetch the GetCapabilities XML when clicking OK? Should that dialog have a separate tab for WMS, to keep the instructions from getting unwieldy? Whatever the case, the JavaScript prompt() will need to be replaced by a proper custom dialog, since some WMS servers require the user to choose from among multiple named layers.

Fixes #4977.

@1ec5 1ec5 added the new-feature A new feature for iD label Oct 5, 2019
@1ec5 1ec5 self-assigned this Oct 5, 2019
@mmd-osm
Copy link
Contributor

mmd-osm commented Oct 6, 2019

I gave it a try on https://deploy-preview-6915--ideditor.netlify.com/ (preview is pretty cool btw!) on the first WMS service I could find on the web: link

Unfortunately, Firefox won't let me use that site due to same origin policy - CORS header ‘Access-Control-Allow-Origin’ missing. The error popup reports a: TypeError: NetworkError when attempting to fetch resource.

@1ec5
Copy link
Collaborator Author

1ec5 commented Oct 6, 2019

Unlike JOSM, iD is subject to CORS and that’s going to be a challenge for any WMS workflow. One possibility would be to fall back to an upload form (or text area) where the user can provide the contents of the GetCapabilities XML file.

This PR does make it possible to take the wms: URL template that JOSM generates and use it as a standard custom background imagery URL template, {bbox} and all. The WMS button doesn’t do a whole lot with the GetCapabilities file; it just uses it to detect MIME types and layer names, and potentially projections. But if we create a dedicated custom dialog for WMS, then all that can be entered manually anyways.

@bhousel
Copy link
Member

bhousel commented Oct 24, 2019

It looks like a good start, but I can't merge it as-is, so this might have to sit for a while.

@1ec5
Copy link
Collaborator Author

1ec5 commented Oct 24, 2019

Yeah, I’m not ready to call it done either. Say, I only went down the path of trying to support GetCapabilities URLs because I wasn’t sure if people could be comfortable deriving the WMS URL templates manually. But what if we land support for WMS URL parameters (9fbf0c3) first, then figure out the UI for GetCapabilities separately?

@bhousel
Copy link
Member

bhousel commented Mar 13, 2020

I ended up including a limited version of this in #7428..

For now, iD can support custom wms templates but we will assume EPSG:3857 for the projection. (I didn't have time to add an input field for the user to type in some different projection or validate it against the limited list of projections iD actually supports)

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
Development

Successfully merging this pull request may close these issues.

Custom WMS imagery
3 participants