timwaters / mapwarper

free open source public map georeferencer, georectifier and warper
http://mapwarper.net
MIT License
193 stars 79 forks source link

CORS issue with ArcGIS Online #165

Open miapartlow opened 5 years ago

miapartlow commented 5 years ago

I received an error when adding the WMS to ArcGIS Online, and reached out to their customer support. I received the following message back, which indicates that there is a conflict with the way Map Warper's WMS is set up. See below. I'm not sure if this is something you can or want to change, but I wanted to address it. I'm planning to teach a workshop with Map Warper and would love to be able to load the maps into ArcGIS Online. Thank you!

From Esri customer support: "Access to XMLHttpRequest at 'https://mapwarper.net/maps/wms/34203?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1' from origin 'https://ess.maps.arcgis.com' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute."

Based on the error received, this seems to be a server-side issue not a client-side issue. The problem seems to be with the way the services are setup that is causing the problem. This is due to how CORS interacts with programs that use java script (ArcGSIS Online). This is also why we don't get an error when creating a connection to the service in ArcGIS Pro.

The way java script works with CORS is that if the "Credentials" mode is set to include (in the developer tools we can see "Access-Control-Allow-Credentials: true", then you cannot have a wildcard as the Access Control Origin. Essentially, the access control origin cannot allow all origins to request the service if credentials are required. To fix this, you can change your Access-Control-Origin from the wildcard (*) to include any origins that are going to request this service.

timwaters commented 5 years ago

https://www.arcgis.com/apps/StorytellingSwipe/index.html?appid=4d2c4acd2fd841588062c912f6d56d48# appears to be working - but uses the tiles endpoint

RyanMattke commented 5 years ago

Oddly, an ArcGIS Online map I created a while ago still works (https://arcg.is/zL5GS), but if I take that same WMS link and try to load it in a new AGOL map, I get the error: "The WMS service, http://mapwarper.net/maps/wms/28361?version=1.1.1, cannot be added to the map. It is either not available or you have entered an invalid URL for the type of layer you want to reference."

Is there a planned fix for this?

timwaters commented 5 years ago

Hmm, I don't have an ArcGIS account (and they are not free). Could you try the tiles endpoint? For example: https://mapwarper.net/maps/tile/1079/{z}/{x}/{y}.png

Looking at the logs, it doesn't appear as if the appropriate header is being set though, so I'll look into this.

miapartlow commented 5 years ago

I have tried the tiles endpoint and it does not work, unfortunately. It places multiple images of the georeferenced maps in a grid across the world map.

You can get a free Public ArcGIS Online account that allows you to pull in data from the web. https://www.arcgis.com/home/createaccount.html

I am happy to help test links if needed.

On Tue, Mar 5, 2019 at 4:35 AM Tim Waters notifications@github.com wrote:

Hmm, I don't have an ArcGIS account (and they are not free). Could you try the tiles endpoint? For example: https://mapwarper.net/maps/tile/1079/{z}/{x}/{y}.png

Looking at the logs, it doesn't appear as if the appropriate header is being set though, so I'll look into this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timwaters/mapwarper/issues/165#issuecomment-469609000, or mute the thread https://github.com/notifications/unsubscribe-auth/AnYqDELBcszTpMN0YMJG4LVjsoLAKdP1ks5vTjp7gaJpZM4X80JO .

--

Mia Partlow NCSU Libraries Fellow Data & Visualization Services, Access Services 919-515-3407 mpduffy@ncsu.edu

my pronouns are: she, her, hers

All electronic mail messages in connection with State business which are sent to or received by this account are subject to the NC Public Records Law and may be disclosed to third parties.

bellegis commented 5 years ago

This is the case for us too! We work at a public library and we have 10,000 historical maps available to be referenced in our website which uses map warper to crowd source the referencing. We'd also like to be able to bring these in to arcGIS online, so students can take advantage of maps that have been already referenced using map warper and use whatever free app builders are available with arcgis online (story maps, etc.... I also second that AGOL is free now for public accounts and you can do a lot with these).

The forJOSM link works for some reason while the WMS does not

RyanMattke commented 4 years ago

Has this been examined and/or resolved?

miapartlow commented 4 years ago

I was able to loan in a tile layer from Map Warper using the following method (note I haven't tried this in a :

In Map Warper, go to the Export tab. Copy the link for Tiles. In an ArcGIS Online map, Add Layer from Web. Choose A Tile Layer from the dropdown. Enter the URL you copied from MapWarper, but change the end of the url from /{z}/{x}/{y}.png to /{level}/{col}/{row}.png.

I hope this helps!

Mia

On Thu, Nov 21, 2019 at 10:55 AM RyanMattke notifications@github.com wrote:

Has this been examined and/or resolved?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timwaters/mapwarper/issues/165?email_source=notifications&email_token=AJ3CUDGOZR2PQSOIEEJFZ7LQU2VO7A5CNFSM4F7TIJHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE2WRLA#issuecomment-557148332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3CUDDD7QKD5NBFQTGZYXLQU2VO7ANCNFSM4F7TIJHA .

--

Mia Partlow NCSU Libraries Fellow Data & Visualization Services, Access Services 919-515-3407 mia_partlow@ncsu.edu

my pronouns are: she, her, hers

mnaglak commented 3 years ago

That did not work when I tried it...