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

Can't grab a screenshot from the QGIS2web Openlayers map #936

Open
Krukarius opened this issue Nov 17, 2020 · 0 comments
Open

Can't grab a screenshot from the QGIS2web Openlayers map #936

Krukarius opened this issue Nov 17, 2020 · 0 comments

Comments

@Krukarius
Copy link

I would love to have my screenshot capture button working.

I came across a few solutions with Openlayers export PDF, export PNG and so on. None of them were working.
Recently I tried the HTML2canvas solution, but still with no result.

All my queries are here:

https://gis.stackexchange.com/questions/379451/making-a-screenshot-from-qgis2web-openlayers-map?noredirect=1#comment620332_379451

https://stackoverflow.com/questions/64823306/save-openlayers-map-as-pdf-offline-version

https://stackoverflow.com/questions/64875245/html2canvas-screenshot-not-working-offline

https://stackoverflow.com/questions/64875940/html2canvas-document-getelementbyid-todataurl-is-not-a-function

https://stackoverflow.com/questions/64877723/html2canvas-in-offline-version-tainted-canvases-may-not-be-exported

https://stackoverflow.com/questions/64875940/html2canvas-document-getelementbyid-todataurl-is-not-a-function

https://gis.stackexchange.com/questions/379339/qgis2web-openlayers-map-export-as-png

https://gis.stackexchange.com/questions/379158/qgis2web-export-open-layers-map-as-pdf-png-or-jpeg

and basically my ideas are runned out right now. Is there any at least one way to export this map in at least one format?
I am aware of CORS issues, but I don't know how to fix them. I came through the ol.js file and changed all crossorigins from I or o to "anonymous". I also put Crossorigin:anonymous in the ol.mpa section:

    var map = new ol.Map({
       controls: ol.control.defaults({attribution:false}).extend([
      expandedAttribution,new ol.control.ScaleLine({}),new measureControl(),new geolocateControl()
      ]),
      target: document.getElementById('map'),
      renderer: 'canvas',
  crossOrigin: 'anonymous',
      overlays: [overlayPopup],
      layers: layersList,
 format: 'image/png',
     view: new ol.View({
         maxZoom: 22, minZoom: 17
     })
    });

not working at all.

I want to launch this option offline. Does it course the aforementioned problems?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant