[pmwiki-users] Announcement: Google Map API v.2.0.0--Hot off the press

Hans hans.bracker at googlemail.com
Wed Aug 23 10:43:49 CDT 2006


On 23/08/06, Ben Wilson <dausha at gmail.com> wrote:
> include_once() == require_once() except that include_once() gets
> tricky when using Win32.[1] So, this argues symantics. I believe I
> always use require_once().

Thanks. I never have heard of it before. I have not had any php
experience apart from what I learned here with pmwiki.

> You have _always_ needed to change the skin with this recipe. I have
> tried to get around this, however HTMLEndFmt does not seem to work
> when there is a skin. I have worked with others to see if there's a
> way around this. However, editing a skin is a minor inconvenience in
> light of what is provided. I use PmWiki's auto-populating arrays as
> much as possible.

Okay. This was my first entry into google maps.

> You shouldn't be hacking the gmaJs file. The whole purpose of that
> file is to provide a library of functions to conserve bandwidth.

Sure. But there is a load function at the beginning of the file, and I
thought it mayb be used.

> If you RTFM, you'll see that the default behavior of the GMA is to
> auto-zoom/center the map on the points given.

This is not apparent when reading Cookbook/GoogleMapAPI.
Or do you mean I should read the Google Map Documentation?
I will do so when I get around to it.
But I missed reading that a point or a line is necessary.
I assumed the map can just be shown without points or lines,
at whatever centered location and zoom level.
If this is not so I would really really like to have this feature,
and be able to set mapcenter lat and mapcenter long. coordinates
both inside the map markup and as possible default values,
so a map can be shown without any point or line being set.

> However, you're supposed
> to be able to set the zoom level both via markup and configuration.
> Inspecting the code, I see I left that out. I will release 2.0.1 with
> this fix.
>
> There is no javascript load function. Researching the API showed no
> need for it, and I do not recall finding an example where a load
> function was used. The maps are self-loading.

Beg to differ. There is a load function in gmaJs.js.
And the html page google provides as a starter when you sign up for a
key has got  a load function. But great if we don't need one.

I used it to get the map centered at  alocation, without using a point:

  $HTMLHeaderFmt['GmapCenter'] = "
        <script type=\"text/javascript\">
        //<![CDATA[
        function load() {
          if (GBrowserIsCompatible()) {
       //     var map = new GMap2(document.getElementById(\"map\"));
            map.setCenter(new GLatLng($clat, $clon), $zoom);
          }
        }
        //]]>
        </script>
  ";

The variables $clat and $clon (for center latitude, center longitude)
I added the same as
variables $width, $height, $zoom etc can be used. Definitely a hack of
the script, and I don't recommend it and rather see you adding
something like it to the script. And I did not like to use this load
function, as I had to do more modification to the skin template in
order to call it. But it was a way to get a result, in my rushed
enthusiasm! If there is a better way I am all for it.

~Hans




More information about the pmwiki-users mailing list