googleMaps plugin Tutorial 05: KML Files

This is part 5 of a series of tutorial for the googleMaps plugin.

KML files allow you to do things such as displaying multiple markers or customized markers in your google maps.

KML Elements Supported in Google Maps

Not all KML elements are supported in Google Maps. Please refer to the following 2 documents for details:


Specifying KML files

To use kml files, use the following syntax:

{googleMaps lat=37.4319720 long=-122.0941430
zoom=12 width=100% height=480
kml=http://www.kksou.com/php-gtk2/gmap/samples/kml_sample1.kml}

Note that you still need to specify the latitude and longitude of the center of the map.

Sample 2

The above sample code is produced by using the following syntax:

{googleMaps lat=53.763325 long=-2.579041 zoom=8 width=100% height=480 
kml=http://www.kksou.com/php-gtk2/gmap/test/KML_Samples12.kml}

Turning off the Marker

  • By default, a red marker will appear at the point where you specify the center of the map
  • You can turn off the red marker by using the parameter marker=0

Default Red MarkerMarker Turned Off
{googleMaps lat=37.4219720 long=-122.0841430
width=100% height=480 zoom=11 kml=http://www.kksou.com/php-gtk2/gmap/samples/kml_sample1.kml}
{googleMaps lat=37.4219720 long=-122.0841430
width=100% height=480 zoom=11 marker=0 kml=http://www.kksou.com/php-gtk2/gmap/samples/kml_sample1.kml}

Specifying Zoom Level

You can specify the zoom level in displaying the KML file.

Zoom = 12Zoom = 10
{googleMaps lat=37.4219720 long=-122.0841430
marker=0 width=100% height=480 zoom=12 kml=http://www.kksou.com/php-gtk2/gmap/samples/kml_sample1.kml}
{googleMaps lat=37.4219720 long=-122.0841430
marker=0 width=100% height=480 zoom=10 kml=http://www.kksou.com/php-gtk2/gmap/samples/kml_sample1.kml}

References for KML files

Here are some references if you wish to learn more about the KML files:

Tutorials for the googleMaps plugin

Tutorials for the googleDirections plugin

Tutorials for the googleDirections_to_here plugin

Comments   

-1 # StefanoP. 2012-04-30 23:52
Gentle Staff,
i have put the html code this {mosmap kml='http://..........kml'|overview='1'}
but the kml file with zoom is to 2 size..why?
Where's the mistake?
Thank you
Stefano
Reply | Reply with quote | Quote
-2 # kksou 2012-05-01 08:29
Hi,

You are using a different plugin!

Please check the starting thttp://www.kksou.com/php-gtk2/#ag. Yours different from the one listed on this page, isn't it?

Regards,
/kksou
Reply | Reply with quote | Quote
0 # StefanoP 2012-05-01 09:25
I search nothing into http://www.kksou.com/php-gtk2/#ag .....pls help me :S
Reply | Reply with quote | Quote
0 # Rcrdop 2012-08-27 08:17
Thank you for great Plugin. Is there a way to not show thew bubble when you click on the marker, or change the text color. Mine comes in a very light color hard to read, so I need to either not show or make text readable
Reply | Reply with quote | Quote
-1 # Ricardo Quartier 2012-09-09 01:42
Dear friend, how are you?

Well i am following your lessons, everything works except lesson 5 with KML

Everything loads markers, etc, except the maps. Where the maps should be just a white background appears.

Even if I try:

{googleMaps lat=37.4319720 long=-122.0941430 zoom=12 width=100% height=480 kml=http://www.kksou.com/gmap/samples/kml_sample1.kml}

It does not work.

If i take the kml out.. works normally.

Do you have any clue, anything i can be missing?
Reply | Reply with quote | Quote
0 # kksou 2012-09-17 08:56
Hi,

I used the same tag as you've written:
http://www.kksou.com/t1510/index.php?option=com_content&view=article&id=107:test-of-googlemaps-120916&catid=34:googlemaps&Itemid=54

Not sure why it didn't work on your site...

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # Diego MF. 2012-09-26 22:55
Hi guys, your plug in is plain amazing, congratulations. I just want to know if I can add a detailed adress in the message that pops up when you mouse over the red marker. I mean it just show the Lat and Log numbers. Thanks for any help on this one. Greetings.
Reply | Reply with quote | Quote
+1 # kksou 2012-09-27 05:25
Hi,

Please refer to: googleMaps plugin Tutorial 01: Getting Started
http://www.kksou.com/php-gtk2/Joomla-Tips-Techniques/googleMaps-plugin-Tutorial-01-Getting-Started.php

Item #2: Specifying Label for the Marker

I suppose you have specified the address using latitude and longitude. That's why you see lat and long being displayed. All you need to do is to add the tag "label".

Please give it a try and let me know if it works, ok?

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # geronimous 2012-10-18 05:05
Hi,

I've tried your plugin and I say "excellent" :lol: I'd like to know if is possible change the icon markers with others (personal labels). I've tried to do that but I'can't. Sorry for my english I hope that you understand. Bye
Reply | Reply with quote | Quote
+1 # kksou 2012-10-18 07:43
Hi,

For display different markers, you need to use KML files as outlined in this tutorial.

You may want to refer to some of the references above: "References for KML files" for more details about KML.

You can also refer to the following article for a sample code: How to display multiple markers in different colors in Google Maps using KML file? http://www.kksou.com/php-gtk2/Joomla-Google-Maps-Samples/How-to-display-multiple-markers-in-different-colors-in-Google-Maps-using-KML-file.php

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # geronimous 2012-10-18 08:25
yes i've already seen that example but I would like to display my own markers (I'm getting crazy but nothing....). Thanks a lot in advance
Reply | Reply with quote | Quote
0 # ruelluis 2012-12-12 10:17
I tried the following code, my map displays but the 10 markers in the kml does not.
{googleMaps lat=10.273983 long=124.005428 width=870 height=700 maptype=SATELLITE zoom=13 kml=http://ruelluis.podserver.info/Evacenter.kml}
Reply | Reply with quote | Quote
+1 # Karol 2013-01-24 10:32
How does the "kml" part work? After diplaying the map it generates the KML file in specified address, right? I cannot find any KML file at the location of my site.
I'm trying this at localhost.
Reply | Reply with quote | Quote
+2 # kksou 2013-01-24 17:33
Hi Karol,

No, this plugin does not generate the KML file. But it can be used to display a KML file that you have generated somewhere else.

Regards,
/kksou
Reply | Reply with quote | Quote
-3 # NickC 2013-02-22 00:36
Great plugin, I've used it a few times. Can't get markers from KML files to display, though. This is my code:

{googleMaps lat=52.766077 long=-1.214676 zoom=12 marker=0 kml=http://lfrs.nanagram.co.uk/maps/lfrs.kml}
Reply | Reply with quote | Quote
-2 # Paquyphoenix 2015-09-27 12:56
Hi Kksou,
Great plugins. We use it to display the location of our members. But since few weeks, the kml informations are not displayed anymore. Is there a problem with latest google maps kml files ?
Regards,
Paquy
Reply | Reply with quote | Quote
+1 # Nik 2016-08-11 10:27
After chaning a category that had a map and a kml file, no map is displayed. Even if I paste code that works elsewhere on the site, nothing is displayed in this category.
Now I am afraid of changing other places if something brakes. Or can it be that Google needs to chache the kml-file?
Reply | Reply with quote | Quote
-1 # Wolfgang 2018-06-28 15:01
Thanks for the Plugin. I think I will use this instead of the mapsplugin from reumer what i used for the last years but now itl isn't under development.

I'm missing one feature at the moment: How to display more than one kml-file in single map? Reumer solved this by using kml[0]=.... kml[1]=.... kml[2]=..... and so on.
I tried different synthax but can't find out if or how it works.

Thanks for Help

Wolfgang
Reply | Reply with quote | Quote
-1 # kksou 2018-06-29 09:42
Hi Wolfgang,

If you look at the article:googleMaps plugin Tutorial 05: KML Files

As you can see on this page, you can display multiple KML files, but it will be across multiple maps using multiple tags like this:

[googleMaps lat=37.4319720 long=-122.0941430
zoom=12 width=100% height=480
kml=http://www.kksou.com/php-gtk2/gmap/samples/kml_sample1.kml]

[googleMaps lat=53.763325 long=-2.579041 zoom=8 width=100% height=480
kml=http://www.kksou.com/php-gtk2/gmap/test/KML_Samples12.kml]

I believe what you want is multiple KML files into one map. For this, my plugin does not support this.

When I designed the plugin, I only wanted a very light-weight plugin for me to display maps on my website. I thought it might be useful, so I decided to share with others in Joomla! Extensions Directory. It's never intended as a replacement for the very powerful reumer's google plugin that I know support many advanced features.

KML files are just plain text file. One thing I can think of is to combine your multiple KML files into just one KML file.

You can google for: combining multiple KML files into one
I see many resources on how to do this.

Saw this
KML Merger: https://kmlmerger.com/
Not sure if it will work for you.

Once you have combined your multiple KML files into one, you can then display the KML file using googleMaps plugiin.

Hope this helps.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-1 # dixet 2018-10-20 19:18
Does the plugin somehow cache kml files? I have changed my kml file but the changes are not reflected on the page
link to page: http://www.mwanamaji.nl/index.php?option=com_joodb&view=catalog&Itemid=199
(click the divemap tab)
link to kml: http://www.mwanamaji.nl/kml/sites.kml
used plugin code: {googleMaps lat=10 long=0 zoom=2 width=100% height=480 kml=http://www.mwanamaji.nl/kml/sites.kml marker=0}

Thank you!
Reply | Reply with quote | Quote
-1 # kksou 2018-10-23 02:47
Hi,

The googleMaps plugin does not cache anything.

But usually your Joomla backend does. Also the browser does. If you uses some other cache-related plugin (e.g. for fast loading), those plugins will also cache the page.

If you change the kml file, then you might need to clear the cache of all these to display the new kml file.

Warm Regards,
/CK
Reply | Reply with quote | Quote

Add comment


Security code
Refresh