toggle visibility of kml folders in GE plugin - google-maps

I have searched high and low for just a snippet of java script code showing this, but all I'm trying to figure out is how to toggle parts of a KML, mainly folders, using check-boxes or similar. Currently the KML is loaded to the plugin using a networklink.
All of the examples I find want you to have separate kml files for everything, but given the sheer number of assets I'm dealing with that wouldn't be feasible. I know this is possible. All I'm looking for is just that one example of "click this, then this "folder" appears".
Any help is greatly appreciated!

Related

Google Slides API REST Resources "Cropped Image" without contentURL?

while trying to export whole presentations of Google Slides with the Google Slides API i'm facing a problem with the export of "cropped images".
If your're using the "crop image" functionality in the Google Slides Editor, to get e.g. a "ROUND_RECTANGLE" appearance for the image, also the type of the page element switches in the exporting REST Resource from "image" to "shape".
So there won't be no more a field in the exported JSON for the contentURL like in the image type and thus it seems not to be possible to load the origin or the "cropped" image file.
Maybe someone knows an alternate workaround or solving for this problem?
I would be pleased if somebody could help me. But i'm also interested in informations why it maybe won't work actually.
Have a nice day!
Hannes

Why are my line colors not showing in my KML file on Google Maps?

I have a KML file from an architect who says he colorized the lines (white, blue, red) and I see the codes in the file itself so I know they are there. The proper colors do display in Google Earth, but NOT in google maps http://lonesomevalley.com/site-map-mapbox/ that I added as a KML layer into MapBox. They also don't display when I bring into the Geojson.io tool so something must be wrong. I see that color is supported by google maps so wondering why it isn't working. Please help! Thanks in advance! My code can be downloaded here: http://evolv.com/lonesome.kml
If I understand the question right, it was the same problem like I had for quit a while. Then someone gave me this quit simple solution.
The colorcodes in kml are in BGR format, while most other formats are the usual RGB format.
The conversion is quit simple: RGB 'ff12dd' will be in BGR 'dd12ff' (R and B just change) but in kml there must always be 'FF' in front, so it will be 'FFdd12ff'
I can't tell you if it's the same issue on your mapbox-implementation(mapbox isn't google maps)
The colors also will not be applied in a google.maps.KmlLayer
The issue seems to be that you've placed the <Style/>'s in <Folder/>'s
When you validate the KML ( http://www.kmlvalidator.com/home ) you'll see that the styles may not be found(and more errors) .
Possible solution( at least related to google-maps): Place the Styles outside of the Folders, as direct childs of <Document/>
Okay after much trial and error working within the KML file, I finally consulted an expert who gave me a simple answer that worked! He said the easiest way to go about changing line colors and weight is through MapBox Editor itself. All you have to do is click on the Data tab, then the 3 horizontal lines button ("hamburger menu drawer icon") to bring up the features. Then you can delete any feature you want from there or click on the feature to change its stroke color and weight. So EASY!!! Just be sure to hit save when done. And there is no Undo if you trash something by mistake so make sure to Save every once in a while and just back out of the project without saving in order to get back something you deleted by mistake.
So all in all I believe that KML files don't bring in the colors of lines correctly to MapBox and therefore need to be corrected through the editor itself.

TableChart in GAS, what are the different options for setOptions()

I can't find an exhaustive list.
I'm trying to set the font size on a TableChart, but can't figure out how or if it's even possible. Searching the internet yielded no source of information on the different options available.
I know you can do the following:
setOption('height' : '100%')
for example, but
setOption('font-size' : '16pt')
and
setOption('fontSize' : '16pt')
Don't seem to work. Any help is appreciated.
Thanks,
Marc
It's not possible, unfortunately. I've tried to style my Table Charts as well, but ended up going with a FlexTable for some of it.
The options are listed in the documentation for the Google Visualization API, which the Charts Service uses (and the Apps Script documentation mentions).

Custom Placemark symbols used in KML not showing up in Google Maps

This is driving me crazy. I've been developing some simple embedded Google Maps such as the following:
http://publicworks.snoco.org/rdclosures/snocordclosuregmaps.html
This map in particular has several kml overlays but one of them is no longer displaying the custom placemark icons I had developed and specified. The problem KML layer is this:
http://publicworks.snoco.org/RdClosures/SnocoRdClosures4Gmaps.kml
Some time in the last few months, the custom symbols stopped displaying and have been replaced by the default placemark symbol. If you open the KML file in Google Earth, it displays properly. The KML file does validate using KmlValidator.
Through my searches on here, I saw a suggestion about using definitions at the top of the KML file and then using within each Placemark. I made that change to my KML but it did not appear to make any difference (the custom icons are still not displaying).
I realize that KML files get cached on Google's end so if you look at my javascript code, I'm using the dummy parameter trick with my KML URL path to force a refresh of the layer. The other thing I will note is that the content of this KML is not static and it frequently changes.
Any ideas? Because I'm stumped!
THANKS!
Steve
Agreed with fragileninja that something is happening with your images between your server and Google's. The usual suspects are timing out and 404s (or other server errors).
Since the KML layer is actually being rasterized to tiles on Google's servers, the request has a relatively short timeout so the tiles aren't delayed from being sent to the browser. If the icon images aren't returned in that time, usually Maps will render using the default icon (as it's doing here). However, I also have no trouble getting the icons to work when I host them on my own server, and I don't see atrocious loading times when I access your icons directly, so it is strange.
It's possible that your servers are taking a longer than usual time to respond to Google's servers specifically, or even that they're returning some HTTP error to them instead of an image.
Can you check your server logs to see if you can see the requests and if they're returning as expected?
Finally, if there's no problem there, I would suggest filing a bug on the Maps API issue tracker. Make sure to pick the appropriate template from the dropdown list (you might also consider making a simpler test case, like just using your KML file with the KmlLayer example from the docs) . If you do end up filing a bug, please link it here and I'll make sure it's looked at.
It's something to do with how your server is serving up the images. If I host the icons on mine, it works fine, and your other KML files are using icons from maps.google.com, which also works fine.
Since it works in GE, I'm guessing maybe your server is sending the wrong MIME type or something along those lines. I checked with curl and everything looks fine though, so I'm afraid I can't offer any more details than that. Hopefully this helps get you in the right direction. Good luck!

Working with large KML files

I have work with a ~23MB kml file. The task is to show the polygons (~5000 shapes) online on a google-map and show some information in a sidebar when a shape is clicked. All the stuff can be done in JS I think. So if I use the large kml file on the page it will load all the 23MB at once and is very slow. It is not necessary to show all polygons at once, so it would be possible to show only parts of it at a certain zoom level. What strategies are common to solve this issue?