publiclab / Leaflet.DistortableImage

A Leaflet extension to distort or "rubber sheet" images
https://publiclab.github.io/Leaflet.DistortableImage/examples/
BSD 2-Clause "Simplified" License
273 stars 284 forks source link

upstream Node-based cloud export service offline in export demo; switch to Ruby-based service for now #751

Open jywarren opened 4 years ago

jywarren commented 4 years ago

Following up on #716, @sashadev-sky noted the following demo wasn't working:

https://publiclab.github.io/Leaflet.DistortableImage/examples/export

@jywarren updated export.html but can't make it work.. also seeing it doesn't work in our gh-pages either so perhaps it never worked? The POST req to //34.74.118.242/api/v2/export/ times out in both scenarios. Going to say fixing that part is out of scope for this PR because i have no idea what is wrong! Just made sure here that we aren't using ajax anymore, etc.

Note I tested the startExport function updates on my own gh-pages page https://sasha.mapknitter.org/examples/select.html so I know its not any src code changes.

Where did this url come from ? //34.74.118.242/api/v2/export/

https://34.74.118.242/api/v2/export/ is our node-based export service. There is another in production on https://mapknitter.org as you can see here:

https://github.com/publiclab/mapknitter/blob/92e73e634550d6ec0e3f1e475d062fe967d54c9a/app/assets/javascripts/mapknitter/Map.js#L661-L676

It uses the Ruby-based cloud exporter at https://export.mapknitter.org, which is online. Let's use this until the Node-based service is back online.

Thanks!!!

jywarren commented 4 years ago

I checked! Switching to https://export.mapknitter.org seems to work, although the way we handle the response is very different; in the export demo we currently:

window.location = statusUrl;

so we'll have to change that too.

jywarren commented 4 years ago

In fact, it returns /id/1600207027/status.json, not an image location. We can look at the MapKnitter implementation to see how this can be parsed and repeatedly accessed until an image is ready, and then display it.

jywarren commented 4 years ago

OK, using GitPod i was able to try this out and it works all right - we'd have to parse the response using code like this:

https://github.com/publiclab/mapknitter/blob/92e73e634550d6ec0e3f1e475d062fe967d54c9a/app/assets/javascripts/mapknitter/Map.js#L678-L717