Hi everyone! I'm pretty new on GMaps and like some help if possible.
I'm drawing polygons on my site and it works fine. The proplem is that
I intend to save those polygons on mySQL database but I don't quite
know how to do it. When I try to use my point[] array to pick the
coordinates, the browser says that point[] is undefined... this is my
bit of code:

<script type="text/javascript">
//<![CDATA[



////map


var map = new GMap2(document.getElementById("map"));

var start = new GLatLng(50.731, -1.848);
map.setCenter(start, 10);
map.addControl(new GMapTypeControl());
map.addControl(new GLargeMapControl());
map.addControl(new GScaleControl());


function showPoly()
{
        // red marker icon
        var icon = new GIcon();
        icon.image = "http://labs.google.com/ridefinder/images/
mm_20_red.png";
        icon.shadow = "http://labs.google.com/ridefinder/images/
mm_20_shadow.png";
        icon.iconSize = new GSize(12, 20);
        icon.shadowSize = new GSize(22, 20);
        icon.iconAnchor = new GPoint(6, 20);
        //icon.infoWindowAnchor = new GPoint(5, 1);



        ///////////////////////
        var marker=[];
        var point=[];
        var poly=[];
        var line=null;

        var lat = map.getCenter().lat();
        var lng = map.getCenter().lng();

        point.push(new GLatLng(lat + 0.00150, lng - 0.00150));
        point.push(new GLatLng(lat + 0.00110, lng - 0.00150));
        point.push(new GLatLng(lat + 0.00070, lng - 0.00150));
        point.push(new GLatLng(lat + 0.00030, lng - 0.00150));
        point.push(new GLatLng(lat + 0.00030, lng - 0.00030));
        point.push(new GLatLng(lat + 0.00030, lng + 0.00040));
        point.push(new GLatLng(lat + 0.00070, lng + 0.00040));
        point.push(new GLatLng(lat + 0.00110, lng + 0.00050));
        point.push(new GLatLng(lat + 0.00150, lng + 0.00050));
        point.push(new GLatLng(lat + 0.00150, lng - 0.00000));
        point.push(new GLatLng(lat + 0.00150, lng - 0.00040));
        point.push(new GLatLng(lat + 0.00150, lng - 0.00080));


        // Add markers on map

        for(var n=0;n<point.length;n++)
        {
        marker[n] = new GMarker(point[n], {icon:icon, draggable: true});
        map.addOverlay(marker[n]);
        marker[n].enableDragging();
        GEvent.addListener(marker[n],'drag',function(){draw()});
        };

        // Draw polygon on map

        function draw()
        {
        poly.length=0;
        for(var i=0;i<marker.length;i++)
        {
        poly.push(marker[i].getPoint());
        }
        poly.push(marker[0].getPoint());
        if(line){map.removeOverlay(line)};
        line=new GPolygon(poly,'#FF0000', 3, 1,'#0000FF',0.2);
        map.addOverlay(line);
        };

Then I try to use this function to grab the coordinates and then it is
says point[] is undefined
It is just a sample as I just tried to see if I could catch the
point[] values

function uploadData()
{
        alert (point[0]);
}

Could anyone help, please?
Thanks in advance

--~--~---------~--~----~------------~-------~--~----~
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