[OpenLayers-Users] Sync KML with image map

miles john.staff2222 at gmail.com
Mon Nov 12 07:46:15 EST 2007


I have a background map in png format and have added it as a layer 
according to the examples using the same Bounds coordinates in the 
example.  I have a KML file with several placemarks in lat/long 
coordinates and added it to my OpenLayers as per the example. 

How do I get the KML lat/long placemarks correctly located on the 
background map?  I tried to set the image layer Bounds to the lat/long 
limits but then the map didn't even show.  Do I need to use a projection ? 

function init(){
  map = new OpenLayers.Map('map');
  var graphic = new OpenLayers.Layer.Image( 'mymap', '/home/mymap.png', 
new OpenLayers.Bounds(-180, -88.759, 180, 88.759), new 
OpenLayers.Size(600, 300), options);
  map.addLayer(new OpenLayers.Layer.GML("KML", "kml/lines.kml", {format: 
OpenLayers.Format.KML}));
  map.zoomToExtent(new 
OpenLayers.Bounds(-112.306698,36.017792,-112.03204,36.18087));
}




More information about the Users mailing list