Thanks for the response Bluestreak2k5. I have seen a fiddle that works. Do you mind sharing a few tips with me on how to get this working based on your experience? I currently have a couple of questions. I am currently thinking of getting the polygons for the locations from openstreetmaps. Still havent figured that out completely but that's my current direction. Then I need to figure out a way to convert them to projected Mercator space. No ideas around that yet.
What do you think? Is there a better way of going about this? How did you get KML files that you used? Can i get KML files from openstreetmaps? Can you share your KML Parser? Thanks once again. On Friday, April 7, 2017 at 3:10:18 AM UTC+1, Bluestreak2k5 wrote: > > That URL for maps isn't valid, that's why it isn't working. You need a > valid URL with valid mapfiles. > > My website still works and I can test my maps URL in JSfiddle as well. > > On Thu, Apr 6, 2017 at 9:42 PM, 'Daniel LaLiberte' via Google > Visualization API <[email protected] <javascript:>> wrote: > >> I believe the loading of map data from any other location but the >> built-in Google Maps server will no longer work due to security >> constraints. The GeoChart.setMapsSource() method is essentially disabled, >> at least for now. >> >> The security issue is that loading data from unknown servers is generally >> a security risk, so we can't do it without risk to any users that may come >> across a web page that does this. I m not sure there is any way we can >> work around that constraint in a secure manner, but it might have to be >> done via a statically known secure server. >> >> I wonder if Google Maps has a way of loading map data from other servers. >> >> On Thu, Apr 6, 2017 at 5:46 PM, BuzzSpace <[email protected] >> <javascript:>> wrote: >> >>> Hi, I am trying to follow this instructions to create a map for states >>> in Nigeria. However, the demo here "Here is a demo where that work >>> <http://www.google.com/url?q=http%3A%2F%2Fjsfiddle.net%2Ff3sXW%2F&sa=D&sntz=1&usg=AFQjCNGb48F8KHI--V_cw00hmL-MIdBEqg>" >>> >>> no longer works. Do you know why it no longer works? >>> >>> On Tuesday, July 9, 2013 at 9:36:04 PM UTC+1, Sergey wrote: >>>> >>>> Okay, this is going to be extremely tricky. The GeoChart expects >>>> everything to be under a base URL, the maps source. By default, the maps >>>> source is set to "https://www.gstatic.com/charts/geochart/10/". You >>>> can set a new maps source by calling google.visualization. >>>> GeoChart.setMapsSource(newSourceUrl), where newSourceUrl is your new >>>> URL (for example, newSourceUrl = *'http://chrisdblumberg.com/maps/ >>>> <http://chrisdblumberg.com/maps/>'*). From this point on, you could >>>> figure out what resources the GeoChart is requesting yourself, and place >>>> them there one by one; but I'm going to help you a bit more. >>>> >>>> Your file isn't formatted correctly. It's not even valid javascript. >>>> You're missing braces around all your features and you're not closing a >>>> lot >>>> of the braces and brackets that you do have. Your lat/longs aren't >>>> supposed >>>> to be formatted as a single string, but as two separate strings, as they >>>> are in the example file. However, because I'm an unreasonably nice person, >>>> I've decided to help you with all of those problems. So here is the >>>> fixed map file >>>> <https://googledrive.com/host/0B5-GB-Crk0g3Ry1WQWpFRENSMVE/js/data/maps/mapfiles/US-AL_PROVINCES.js>, >>>> >>>> and here is a jsfiddle using it <http://jsfiddle.net/j2WB2/>. But I'm >>>> sure you'll notice a few funny things happening. The first thing is that >>>> all the counties look off on the Y axis. This is because all the >>>> coordinates are supposed to be in *projected Mercator space*, like I >>>> mentioned in my last response. You can find the formula for converting >>>> your >>>> coordinates on the Mercator Projection Wikipedia page >>>> <http://en.wikipedia.org/wiki/Mercator_projection>. For mercator, you >>>> only need to project the latitude, and not the longitude, so it's pretty >>>> easy. For simplicity sake, you can just use the formula below: >>>> projectedLatitude = (180 / PI) * log(tan(latitude / 180 * PI / 2 + PI / >>>> 4)); >>>> >>>> The other thing that you may notice is that the regions in my example >>>> aren't being highlighted. This is a harder problem to solve. It's >>>> happening >>>> because the GeoChart tries to geocode the IDs without ever checking if the >>>> given IDs match the map IDs. This is a bug. Kind of. Until I figure out a >>>> permanent fix, you're going to have to hack around it. The trick here is >>>> to >>>> fit the format of a province code so that the GeoChart doesn't fall back >>>> on >>>> geocoding. The GeoChart will fall back on geocoding (in the case of a >>>> province) if the ID doesn't match the format of "two letters, followed by >>>> a >>>> dash, followed by two alphanumeric characters". One way to get around this >>>> problem is to encode your provinces as hex, and use AL as the 'country >>>> code' (I put it in quotes because it's not really the country code, and >>>> using US-AL-XX doesn't work). So, since everything is in the format of >>>> US-AL-1DDD (where D's are digits), and all the codes -1000 are under 255, >>>> we can encode them as hex. So US-AL-1001 becomes AL-01, US-AL-1005 becomes >>>> AL-05, US-AL-1010 becomes AL-0A, and so on. Here is a demo where that >>>> works >>>> <http://www.google.com/url?q=http%3A%2F%2Fjsfiddle.net%2Ff3sXW%2F&sa=D&sntz=1&usg=AFQjCNGb48F8KHI--V_cw00hmL-MIdBEqg>. >>>> >>>> Note that I'm using a different path there and loading a different map, >>>> where all the counties are renamed. >>>> >>>> The other polygons in that file are the other states. Good call on >>>> leaving them alone, since now you can make sure that your counties match >>>> up >>>> to them, and you can have some context for what you're looking at. >>>> >>>> - Sergey >>>> >>>> >>>> On Tue, Jul 9, 2013 at 2:48 PM, Bluestreak2k5 <[email protected]> >>>> wrote: >>>> >>>>> Thanks so much Sergey! >>>>> >>>>> I have converted the KML to a JS file like you linked me to, it is >>>>> here: >>>>> http://chrisdblumberg.com/us_counties/alabama_counties.js >>>>> >>>>> I replaced the polygon id="US-AL" with all the polygons of the >>>>> individual counties. >>>>> >>>>> Each county is represented by an ID using the FIPS code, such as >>>>> US-AL-1001 would represent Autauga county in Alabama. This should >>>>> allow for easy future expansion as this is a Unique identifier to each >>>>> county. >>>>> >>>>> How would I go about testing this map now, and would this be the >>>>> correct way of doing it? I wasn't sure about the other polygons that were >>>>> in that file so I left them all alone and are located at the bottom. >>>>> >>>>> Chris >>>>> >>>>> -- >>>>> 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 [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at >>>>> http://groups.google.com/group/google-visualization-api. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>>> >>>>> >>>> >>>> -- >>> 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 [email protected] >>> <javascript:>. >>> To post to this group, send email to [email protected] >>> <javascript:>. >>> Visit this group at >>> https://groups.google.com/group/google-visualization-api. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/google-visualization-api/de02f3f1-63e5-4ecf-bce0-2dc2551dff42%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/google-visualization-api/de02f3f1-63e5-4ecf-bce0-2dc2551dff42%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> >> [email protected] <javascript:> 5CC, Cambridge MA >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Google Visualization API" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/google-visualization-api/KVGu--jjUpk/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at >> https://groups.google.com/group/google-visualization-api. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJOFbNz4u%3DWvgm%2BNmH2Dex%3Dydzv-ohqOr6aqDW5gL_%2BW_Q%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJOFbNz4u%3DWvgm%2BNmH2Dex%3Dydzv-ohqOr6aqDW5gL_%2BW_Q%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/facc5b9a-1914-4cd0-ac22-dd017d6da45f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
