On Nov 29, 12:10 am, PHL <[EMAIL PROTECTED]> wrote:
> bratliff,
>
> What about situations where we ask for a span from the Static API
> (because we want to ensure that a certain area is visible)?  Then I
> think we won’t know the zoom level z...
> I want to draw some transparent shapes on the image (these shapes have
> WGS84 data so I think as far as actually getting the map and this
> "layer" (the word loosely used) to work together, they are
> compatible), but I want to do that server-side, so no JavaScript,
> hence only static api — unfortunately I can’t depend on the visiting
> device's JS capabilities.
>
> Thanks,

Without the ability to control the DOM, you cannot use "createElement
()" to add images on the fly.  It is illegal to blend your images with
Google's map on your server.  To do it legally, you must do it in the
browser.

One way of doing it in HTML is:

    <div id="container"
style="position:relative;width=XXpx;height=YYpx;">
        <img id="google" src="whatever"
style="position:absolute;left=0px;top=0px;width=100%;height=100%;">
        <img id="layer0" src="whatever"
style="position:absolute;left=0px;top=0px;width=100%;height=100%;">
        <img id="layer1" src="whatever"
style="position:absolute;left=0px;top=0px;width=100%;height=100%;">
        . . .
    </div>

Your images must be either GIFs or PNGs.  AlphaImageLoader will not be
an issue unless your users might be using Internet Explorer.

I have never used "span".  I believe it uses a bounding box to
determine the zoom level plus the center.

Convert the corners of your bounding box to pixels.

    x0=LToX(Lon0);
    x1=LToX(Lon1);

    y0=LToY(Lat0);
    y1=LToY(Lat1);

Find the largest zoom level for which:

    (Math.abs(x1-x0)>>(21-z)) <= width;
    (Math.abs(y1-y0)>>(21-z)) <= height;

You can use base 2 logs or you can simply loop through zoom levels.

You can convert your center to Lat/Lon coordinates regardless of zoom
level.

    {x:XToL((x1+x0)/2),y:YToL((y1+y0)/2)};

If you are using a WMS server, it may not support Google's Mercator
projection.  You will have to use EPGS:4326 if nothing else is
available.  For good alignment, you may have to fake it by cutting
your layers into strips.

The file:

    www.polyarc.us/poly

has code for tiling WMS layers but it requires JavaScript.

The file:

    www.polyarc.us/adjust.js

contains JavaScript functions for

    XToL
    YToL
    LToX
    LToY

You will have to convert to whatever langauge you are using on your
server.  I believe Mika Tuupola has already done it for PHP.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to