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

Issue when creating image of google maps #413

Open
da-saiyam-shah opened this issue Jun 30, 2023 · 6 comments
Open

Issue when creating image of google maps #413

da-saiyam-shah opened this issue Jun 30, 2023 · 6 comments
Labels

Comments

@da-saiyam-shah
Copy link

I am using google maps, and drawing some shapes on maps like Circle, Polygon etc.
When I try to capture 1st time, it works perfectly, but when I do it second time, it is not giving proper screenshot.

Expected Behavior

Should capture proper screenshot even on multiple attempts.

When I capture 1st time.
GeoMapping

But when I capture 2nd time?
GeoMapping (1)

Also, if I reload the page, it will work 1st time, 2nd time it will not work.

@vivcat
Copy link
Contributor

vivcat bot commented Jun 30, 2023

👋 @da-saiyam-shah

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@Y3drk
Copy link

Y3drk commented Aug 5, 2023

Run into the same issue

@fabientownsend
Copy link

I ran into a very similar issue, there way I have it is as follows:

  1. I'm rendering the map with GoogleMap from @react-google-maps/api
  2. Download the map once which is the expected result using the following code
htmlToImage.toJpeg(document.getElementById('my-node'), { quality: 0.95 })
  .then(function (dataUrl) {
    var link = document.createElement('a');
    link.download = 'my-image-name.jpeg';
    link.href = dataUrl;
    link.click();
  });
  1. when downloading a second time I have the similar issue initially shown, even though I haven't made any change to the GoogleMap component

From the console log, I have the following error, but I don't think it is related:

app-index.js:32 Error while reading CSS rules from https://fonts.googleapis.com/css?family=Google+Sans+Text:400&text=%E2%86%90%E2%86%92%E2%86%91%E2%86%93&lang=en DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

@fabientownsend
Copy link

I actually managed to get it working. The source of the issue seems to be related to caching, using the following parameter did the trick for me: includeQueryParams: true.

Here is a similar issue with its solution that lead me to that resolution: #431

@da-saiyam-shah
Copy link
Author

@fabientownsend By setting includeQueryParams: true, does it solve the original issue? or this particular error:
app-index.js:32 Error while reading CSS rules from https://fonts.googleapis.com/css?family=Google+Sans+Text:400&text=%E2%86%90%E2%86%92%E2%86%91%E2%86%93&lang=en DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

@fabientownsend
Copy link

@fabientownsend By setting includeQueryParams: true, does it solve the original issue? or this particular error: app-index.js:32 Error while reading CSS rules from https://fonts.googleapis.com/css?family=Google+Sans+Text:400&text=%E2%86%90%E2%86%92%E2%86%91%E2%86%93&lang=en DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

It only solves the original issue 👍

I can confirm that the other error that I mentioned Error while reading CSS rules from... is unrelated to the original issue

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

No branches or pull requests

3 participants