Hi Varsha,

Indeed, I am seeing this error in my chrome devtools debugger when I
visit:  http://varshg.com/county/UrbanGrasslandPM2.5.html

"Access to XMLHttpRequest at '
https://varsha2509.github.io/maps/info/mapList.js' from origin '
http://varshg.com' has been blocked by CORS policy: No
'Access-Control-Allow-Origin' header is present on the requested resource."


However, when I do: curl -vL varsha2509.github.io/maps/info 2>&1 | fgrep -i
access-control-allow-origin

I get:

< Access-Control-Allow-Origin: *
< Access-Control-Allow-Origin: *


So it would seem to be allowed, if that is what the curl output means.  I'm
afraid I don't know how to help you further.  Perhaps someone from github
can help out.

On Sun, Oct 18, 2020 at 7:33 PM Varsha Gopalakrishnan <
varsha.gopalakrish...@gmail.com> wrote:

> Hi Daniel,
> I'm facing the same issue as Donal. I tried pointing the setMapsSource
> function to both my github page-hosted data (see screenshot 1) as well as
> chrisdblumberg.com/maps (see screenshot 2), but I'm getting CORS error in
> both cases. By default, github does support CORS
> <https://stackoverflow.com/questions/26416727/cross-origin-resource-sharing-on-github-pages>
> so I'm not sure what else could be the reason for the error below. Any
> thoughts? Just FYI, my website (maps) was working fine until earlier this
> year but I'm not sure what changed!
>
> I've posted two screenshot below with the CORS error message.
>
> 1) Link: http://varshg.com/county/UrbanGrasslandPM2.5.html
>
> 2) http://varshg.com/county/RuralGrasslandNO2.html
>
>
> Thanks!
>
> On Wednesday, July 8, 2020 at 12:12:48 PM UTC-7 Daniel LaLiberte wrote:
>
>> What do you see in your browser debugger?  If there is still a JSON
>> problem, it will likely show up there.
>>
>> If you are serving these files from your server, you have to configure it
>> so that the server allows cross-origin requests for the data.  This was
>> already true for the chrisblumberg.com site, I believe.   If not
>> allowed, you will see an error about CORS when fetching the data, maybe
>> only in the network tab of the debugger.
>>
>> If you can post a link to a page demonstrating how you are using GeoChart
>> with this setMapsSource, that would allow me to debug it.
>>
>> On Wed, Jul 8, 2020 at 2:58 PM Donal Harrigan <harriga...@gmail.com>
>> wrote:
>>
>>> I downloaded all the files and took the comments out of the mapList.js
>>> and couldn't find any in the .js files in the mapfiles subfolder. I put it
>>> up on Drive and set that as the map source and it's still blank. Any other
>>> thoughts?
>>>
>>> *Donal Harrigan*
>>>
>>>
>>> On Wed, Jul 8, 2020 at 1:55 PM 'Daniel LaLiberte' via Google
>>> Visualization API <google-visua...@googlegroups.com> wrote:
>>>
>>>> mapList.js would be the first place.  But any subsequently loaded data
>>>> file as well.
>>>>
>>>> On Wed, Jul 8, 2020 at 1:45 PM Donal Harrigan <harriga...@gmail.com>
>>>> wrote:
>>>>
>>>>> Are you referring to the mapList.js file in the info subdirectory? I
>>>>> believe that's the only place I see comments.
>>>>>
>>>>> *Donal Harrigan*
>>>>>
>>>>>
>>>>> On Wed, Jul 8, 2020 at 1:25 PM 'Daniel LaLiberte' via Google
>>>>> Visualization API <google-visua...@googlegroups.com> wrote:
>>>>>
>>>>>> For the setMapsSource call, it is now essential that the data
>>>>>> portion of the returned data is strict JSON, which doesn't allow embedded
>>>>>> comments.  I believe the data from http://chrisdblumberg.com/maps does
>>>>>> still include comments, so hopefully, Chris Blumberg can update the 
>>>>>> county
>>>>>> data.  Thanks.
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 8, 2020 at 1:15 PM Donal Harrigan <harriga...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> As an update, I did the following but still cannot get the custom
>>>>>>> map to plot.
>>>>>>>
>>>>>>> created an Index.html in my apps script project:
>>>>>>> <html>
>>>>>>>   <head>
>>>>>>>     <script src="https://www.gstatic.com/charts/loader.js";></script>
>>>>>>>     <script>
>>>>>>>       google.charts.load('current', {packages: ['geochart']});
>>>>>>>       google.charts.setOnLoadCallback(queryGID);
>>>>>>>
>>>>>>>       function queryGID() {
>>>>>>>         var queryString = encodeURIComponent('SELECT EF,EG');
>>>>>>>         var query = new google.visualization.Query(<MY SHEET URL> +
>>>>>>> queryString);
>>>>>>>         query.send(handleQueryResponse);
>>>>>>>       }
>>>>>>>       function handleQueryResponse(response){
>>>>>>>         if (response.isError()) {
>>>>>>>           alert('Error in query: ' + response.getMessage() + ' ' +
>>>>>>> response.getDetailedMessage());
>>>>>>>           return;
>>>>>>>         }
>>>>>>>         google.visualization.GeoChart.setMapsSource(<URL TO DRIVE
>>>>>>> STORED DOWNLOAD OF ANDREW'S MAP FILES>);
>>>>>>>
>>>>>>>         var options =
>>>>>>> {displayMode:'regions',region:'US-FL',resolution:'provinces'};
>>>>>>>         var data = response.getDataTable();
>>>>>>>         var chart = new
>>>>>>> google.visualization.GeoChart(document.getElementById("regions_div"));
>>>>>>>         chart.draw(data,options);
>>>>>>>         google.visualization.events.addListener(chart,
>>>>>>> 'regionClick', function(r) {
>>>>>>>           console.log(r.region);
>>>>>>>         });
>>>>>>>       }
>>>>>>>     </script>
>>>>>>>   </head>
>>>>>>>   <body>
>>>>>>>     <div id="regions_div" style="width: 900px; height: 500px;"></div>
>>>>>>>   </body>
>>>>>>> </html>
>>>>>>>
>>>>>>> created a doGet in my project:
>>>>>>> function doGet(){
>>>>>>>   return HtmlService.createHtmlOutputFromFile('Index');
>>>>>>> }
>>>>>>>
>>>>>>> Published the project as a webapp.
>>>>>>>
>>>>>>> Results: If I publish without the setMapsSource line then I get a FL
>>>>>>> zoom map without counties, if I publish with the setMapsSource line 
>>>>>>> then no
>>>>>>> map shows up at all. I also tried this for the maps db referenced 
>>>>>>> earlier
>>>>>>> in the email (http://chrisdblumberg.com/maps) with the same results.
>>>>>>>
>>>>>>> Any guidance would be greatly appreciated!
>>>>>>>
>>>>>>> On Wednesday, July 8, 2020 at 10:06:18 AM UTC-4, Donal Harrigan
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> I'd like to be able to set the map source through Google Apps
>>>>>>>> Script. From reading this thread it appears that the methodology is 
>>>>>>>> through
>>>>>>>> the client-side API. Is there a way to accomplish this by sourcing and 
>>>>>>>> html
>>>>>>>> file within Google apps script with a doGet? I set up a simple example:
>>>>>>>>
>>>>>>>> index.html
>>>>>>>> <html>
>>>>>>>>   <head>
>>>>>>>>     <script>Enter code here...
>>>>>>>>       google.script.run.doSomething();
>>>>>>>>     </script>
>>>>>>>>   </head>
>>>>>>>>   <body>
>>>>>>>>   </body>
>>>>>>>> </html>
>>>>>>>>
>>>>>>>> test.gs
>>>>>>>> function doGet(){
>>>>>>>>   return HtmlService.createHtmlOutputFromFile('Index');
>>>>>>>> }
>>>>>>>> function doSomething(){
>>>>>>>>   Logger.log("What");
>>>>>>>> }
>>>>>>>>
>>>>>>>> I published the project to the web and if I visit the link, then
>>>>>>>> doSomething executes but if I call the url with urlfetchapp only the 
>>>>>>>> doGet
>>>>>>>> executes but not doSomething
>>>>>>>>
>>>>>>>> UrlFetchApp.fetch(theURL,{method:"Get", headers: {Authorization:
>>>>>>>> "Bearer "+ScriptApp.getOAuthToken()}, muteHttpExceptions: true});
>>>>>>>>
>>>>>>>> If I can get that framework working, is it possible then to just
>>>>>>>> include the following line in the html file
>>>>>>>>
>>>>>>>> <script type='text/javascript' 
>>>>>>>> src='https://www.google.com/jsapi'></script>
>>>>>>>>
>>>>>>>>
>>>>>>>> and then be able to do anything 'google.visualization' within the
>>>>>>>> .gs script?
>>>>>>>>
>>>>>>>>
>>>>>>>> On Friday, April 24, 2020 at 10:16:26 PM UTC-4, Andrew Arnold wrote:
>>>>>>>>>
>>>>>>>>> JS county map files for every state (inc. Puerto Rico) and the
>>>>>>>>> United States can be downloaded here:
>>>>>>>>> https://drive.google.com/open?id=1j7yGIG7xmGuQ0yOptkeJK8txBA9aYvMM
>>>>>>>>>
>>>>>>>>> These were generated from KML files maintained by the U.S. Census
>>>>>>>>> Bureau.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Google Visualization API" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to google-visualizati...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/google-visualization-api/d44172a8-6e07-4f0a-8c4f-f8c2210052c1o%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/d44172a8-6e07-4f0a-8c4f-f8c2210052c1o%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Daniel LaLiberte
>>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>>>> dlalibe...@google.com   Cambridge MA
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Google Visualization API" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to google-visualizati...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMzBEu0ut9DNwXeUpXwvMtdm9XBHXbgSWSbEGaQvR9CQg%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMzBEu0ut9DNwXeUpXwvMtdm9XBHXbgSWSbEGaQvR9CQg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Google Visualization API" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to google-visualizati...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/google-visualization-api/CADsXKFVY9UhSm7Z3CP3qsLWM04WA96Dwb_r-5%3D8CsrdmPycZig%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/google-visualization-api/CADsXKFVY9UhSm7Z3CP3qsLWM04WA96Dwb_r-5%3D8CsrdmPycZig%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>> --
>>>> Daniel LaLiberte
>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>> dlalibe...@google.com   Cambridge MA
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Visualization API" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to google-visualizati...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMW_aVOw7HLf_%2ByY%2BEOMtCxR9jZg0R3armEm93MySO8iQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMW_aVOw7HLf_%2ByY%2BEOMtCxR9jZg0R3armEm93MySO8iQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Visualization API" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to google-visualizati...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-visualization-api/CADsXKFUXmKi5Bbri%2BRQAgyyj1K5%2BdU-quVeuv3MF_%3Dg49Gunvg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/google-visualization-api/CADsXKFUXmKi5Bbri%2BRQAgyyj1K5%2BdU-quVeuv3MF_%3Dg49Gunvg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>> dlalibe...@google.com   Cambridge MA
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-visualization-api+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/889d55e4-98df-45b8-857a-d55937182199n%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/889d55e4-98df-45b8-857a-d55937182199n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
dlalibe...@google.com <dlalibe...@google.com>   Cambridge MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPpvBys%2BOZDS4df9wc6DyRiuhgTZtFTFWNY5XBXC%2BgEdw%40mail.gmail.com.

Reply via email to