Google Map v2.1 released – now with KML support

The release of Goole Map version 2.1 supports KML files which once displayed can even be downloaded as GPX files.

Download from the WordPress plugin repository.

The following example uses the included example.kml file.

tgooglemap(example.kml)

The following examples use the included example.xml file.

<markers>
<!-- Marker Z has no html to show nonclickability-->
<marker lat="-31.9554" lng="115.85859"  icon="Z" color="c89bff"/>
<marker lat="-32.053128" lng="115.745869" html="Fremantle"  icon="1" color="6b98ff"/>
<!-- Standard marker with html-->
<marker lat="-32.036036" lng="115.92724" html="<b>Lynwood</b><br>Residence of the author" color="ffed5c"/>
<marker lat="-31.963013" lng="115.836239" html="Kings Park" icon="KP" color="97ec7d"/>
<!-- Character marker with html that includes link-->
<marker lat="-31.956659" lng="115.869906" html="<a href="http://perthmint.com.au" rel="nofollow">Perth Mint</a>" icon="$" color="ffffff"/>
<!-- Example of two lines-->
<line colour="#0000FF" width="2" opacity="0.75">
<point lat="-32.027579" lng="115.751266" />
<point lat="-31.987404" lng="115.769463" />
<point lat="-31.957697" lng="115.852203" />
<point lat="-31.963814" lng="115.879326" />
<point lat="-32.026415" lng="115.942154" />
</line>
<points colour="#FF0000" width="4" opacity="0.75">
<point lat="-32.053128" lng="115.745869" />
<point lat="-31.963013" lng="115.836239" />
<point lat="-31.9554" lng="115.85859" />
<point lat="-31.956659" lng="115.869906" />
<point lat="-32.036036" lng="115.92724" />
</points>
</markers>
  • Marker Z – no HTML, nonclickable.
  • Marker 1 – standard maker with some text.
  • Marker Default – no icon defaults to standard Google Maps marker.
  • Marker $ – symbols can even be displayed on a marker and links in the HTML.
  • Marker KP – up to two characters can be displayed.

To display a map, simply type;

tgooglemap(example.xml)

For the more adventurous;

tgooglemap(example.xml, width, height, zoom, maptype)

where;

  • example.xml is your xml file, and example xml file is included with thdyzikGoogleMap in the plugin directory.
  • width is the optional width parameter, if left out the default width defined in the tgooglemap options will be used.
  • height is the optional height parameter, if left out the default height defined in the tgooglemap options will be used.
  • zoom is the optional zoom level from 0 to 17 (0 being the furthest away), if left out zoom will be calculated automatically to fit all points.
  • maptype is the optional map type parameters, which can be (Normal, G_NORMAL_MAP, N), (SATELLITE, G_SATELLITE_MAP, S), (HYBRID, G_HYBRID_MAP, H), (PHYSICAL, G_PHYSICAL_MAP, P, TERRAIN or T) if left out Normal is defined.

Normal, G_NORMAL_MAP, N or left out; i.e. tgooglemap(example.xml), tgooglemap will produce a default styled map;

tgooglemap(example.xml)

SATELLITE, G_SATELLITE_MAP, S; i.e. tgooglemap(example.xml, 4, S), tgooglemap will produce a satellite styled map. Note I have included a zoom of 4, and used the abreviation ‘S’;

tgooglemap(example.xml, 4, S)

HYBRID, G_HYBRID_MAP, H; i.e. tGoOgLeMaP(example.xml,hYbRiD,450,225), tGoolgeMap will produce a hybrid styled map. Note I have included a width and height, and proved that capitalisation is not of concern;

tGoOgLeMaP(example.xml, hYbRiD, 450,225)

PHYSICAL, G_PHYSICAL_MAP, P, TERRAIN or T; i.e tgooglemap(example.xml,TERRAIN), tgooglemap will produce a terrain styled map;

tgooglemap(example.xml,TERRAIN)

Reading XML from different folder
The XML can be in any location, as long as the whole path is specified i.e. tgooglemap(https://mectile.com/geocaching/karratha-mar08/karratha-mar08.xml). Yes, even links in the marker text are preserved.

tgooglemap(https://mectile.com/geocaching/karratha-mar08/karratha-mar08.xml)

Reading XML from different domain
The XML can even be on a different domain, as long as the whole path is specified. i.e. tgooglemap(http://xxxxxx.com/maps/our-nullarbor-adventure-clare-melbourne08.xml).

tgooglemap(http://xxxxxx.com/maps/our-nullarbor-adventure-clare-melbourne08.xml)


Posted

in

by

Tags:

Comments

2 responses to “Google Map v2.1 released – now with KML support”

  1. Erik Harris Avatar

    Travis – this is a great plugin, and I use it on multiple sites, but I recently encountered a problem with another plugin that I traced back to this one. You have these three lines in the plugin code:

    wp_deregister_script("jquery");
    wp_register_script("jquery", "https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js", array(), Null);
    wp_enqueue_script("jquery");

    These lines disable the current version of jQuery that WordPress automatically loads and then load a much older version of jQuery, which lacks features that some other plugins use. I commented the three lines out of my copy, and your plugin still works fine. If you do update, I’d recommend removing these lines. I’m guessing that maybe they’re left over from before WordPress automatically loaded jQuery.

    1. Travis h Avatar

      Erik,
      Thanks for the info.
      I shall take that on-board when I get around to next update.
      Travis

Leave a Reply

Your email address will not be published. Required fields are marked *