Hello Rossko,

First of all thank you for your reply.
 I wrote code for displaying the marker that created from the point geometry
from postgis table. I got the result correctly. Then I wrote code for
loading the polygon from kml file. After that only the map is displayed
without the marker and polygon.But the required output is the map display
with marker and polygon at the same time.

My code is given below.

 var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
     var tooltip = document.createElement("div");
      document.getElementById("map").appendChild(tooltip);
      tooltip.style.visibility="hidden";

        var gmarkers = [];
        var lat1 = parseFloat(lat);
          var lon1 = parseFloat(lon);
           map.setCenter(new GLatLng(8.57427255931071,76.9657789647228),
10);

       GDownloadUrl("panch_zoom1.php", function(doc) {
        var xml = GXml.parse(doc);
        var markers =xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
          // obtain the attribues of each marker
          var lat1 = parseFloat(markers[i].getAttribute("lat"));
          var lon1 = parseFloat(markers[i].getAttribute("lng"));
          var point = new GLatLng(lat1,lon1);
          var pname = markers[i].getAttribute("Panchayat");

var marker = createMarker(point,pname);
              gmarkers.push(marker);

       }
       });

//code for loading kml

var exml;
     exml = new EGeoXml("exml", map, "TVMKML.kml", {nozoom:true});
     exml.parse();
 function createMarker(point,pname)
         {
                  // Create our "tiny" marker icon

var tinyIcon = new GIcon();

            tinyIcon.image = "
http://maps.google.com/mapfiles/kml/shapes/placemark_square.png";;
            tinyIcon.shadow = "
http://labs.google.com/ridefinder/images/mm_20_shadow.png";;
            tinyIcon.iconSize = new GSize(10, 25);
            tinyIcon.shadowSize = new GSize(20, 18);
            tinyIcon.iconAnchor = new GPoint(5, 18);
            tinyIcon.infoWindowAnchor = new GPoint(4, 1);

 var opt;
 opt = {}

 opt.icon = tinyIcon;
 opt.draggable = false;
 opt.clickable = true;
 opt.dragCrossMove = true;

    var marker = new GMarker(point,opt);
    marker.tooltip = '<div class="tooltip">'+pname+'<\/div>';
        GEvent.addListener(marker, "click", function()
         {
         map.panTo(marker.getLatLng());
          marker.openInfoWindowHtml(pname);
        });

     map.addOverlay(marker);
     //  ======  The new marker "mouseover" and "mouseout" listeners  ======
        GEvent.addListener(marker,"mouseover", function() {
          showTooltip(marker);
        });
        GEvent.addListener(marker,"mouseout", function() {
        tooltip.style.visibility="hidden"
        });
     }
function showTooltip(marker) {
          tooltip.innerHTML = marker.tooltip;
    var
point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom());
    var
offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
    var anchor=marker.getIcon().iconAnchor;
    var width=marker.getIcon().iconSize.width;
    var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x
- point.x - anchor.x + width,- offset.y + point.y +anchor.y));
    pos.apply(tooltip);
    tooltip.style.visibility="visible";
      }

Is there any mistake in this code,please help me to correct.

Thanks,
Sreejith.R

On Fri, Aug 7, 2009 at 2:31 PM, Rossko <[email protected]> wrote:

>
> > Can anyone tell me, is it possible to load polygon from kml file and
> marker
> > created by using the point geometry from my postgis table to same map at
> > same time.
>
> Yes.
> Well, not really at exactly the same time, but you can load data from
> multiple sources onto one map and have them all visible at the same
> time.
>
> > If possible tell me how?
>
> Write some code to load the KML.
> Write some code to load markers from whatever mechanism (XML, JSON,
> whatever) that you have chosen to get data from postgis.
>
> > Please help me..
>
> The more specific you can make the question, the better the help can
> be.  What have you tried so far?  Which bit are you stuck on?
>
> cheers, Ross K
> >
>


-- 
Sreejith.R

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