Adding KML layer to map

501
6
03-14-2012 11:31 AM
BetsySchenck-Gardner
Occasional Contributor
I have to add a kml layer to a map.  This is the kml url address I was given:

http://edac-dap.northerngulfinstitute.org/erddap/griddap/MODIS_Aqua_3-day_composite_CHL.kml?chl_a[(last)][(17.086376190185547):(31.566356658935547)][(-97.91387176513672):(-78.65940856933594)]&.draw=surface&.vars=longitude|latitude|chl_a&.colorBar=Rainbow||Log|0|50|

This address will open in Google Earth and Google Maps properly but I can't seem to get it to do anything in the ArcGIS JavaScript API.  I've made sure to load the esri.layers.KMLLayers utility.  I made a variable called kmlURL and have the url address I posted above saved to that variable.  I then try to add the kml by using the new esri.layers.KMLLayer(kmlURL) to the map.  Nothing happens.  Is the URL address I've been given too complicate?  Any help would be greatly appreciated.
0 Kudos
6 Replies
derekswingley1
Frequent Contributor
Can you post that URL in code tags? The forum software is interpreting pieces of it at emoticons.

As long as your URL returns a KML file, the API will be able to use it.
0 Kudos
BetsySchenck-Gardner
Occasional Contributor
I don't know how to do that.  The emoticons are colons.
0 Kudos
derekswingley1
Frequent Contributor
Put your URL between [ code ] and [ / code ] but without the spaces between the brackets.

Edit:  I think I got it:
http://edac-dap.northerngulfinstitute.org/erddap/griddap/MODIS_Aqua_3-day_composite_CHL.kml?chl_a[(last)][(17.086376190185547):(31.566356658935547)][(-97.91387176513672):(-78.65940856933594)]&.draw=surface&.vars=longitude|latitude|chl_a&.colorBar=Rainbow||Log|0|50|


Let me look into this. I'll post back shortly.
0 Kudos
derekswingley1
Frequent Contributor
This is probably an issue with the the KMLLayer is handling this URL. If I enter the URL directly in the arcgis.com service that converts KML to JSON, it works:  http://arcgis.com/sharing/kml?url=http%3A%2F%2Fedac-dap.northerngulfinstitute.org%2Ferddap%2Fgriddap...

I'll keep looking and will post back here if I find a fix.
0 Kudos
BetsySchenck-Gardner
Occasional Contributor
Thanks Derek. I really appreciate your help on this.
0 Kudos