[OpenLayers-Users] Making vector layers.

Robert M. Wood RWood at entrix.com
Mon May 17 11:41:50 EDT 2010


I am having difficulty figuring out how to make a vector layer. At this point I have tried at least two different methods. One is importing the data as a KML file out of geoserver, the KML works fine in Google earth so I don't think it is an issue with the KML. The other is using WFS. In IE I am getting an unspecified error on line 634 of OpenLayers.js and firefox just does not display anything for that layer, it shows up in the layer switcher but does not show up on the map. The map_init function is called from body onload.

My actual goal is to fire onhover events from the points in the vector layer. The WMS layer is just the imagery. I am using the 2.9.1 version of openlayers.

var poles = null;
  var map = null;
  var drawControls;

function map_init(){

  //map = new OpenLayers.Map('map');

  map = new OpenLayers.Map({
    div: "map",
    maxExtent: new OpenLayers.Bounds(
      -82.134,27.544,-81.968,27.678
    ),
    allOverlays: true
  });

  var base = new OpenLayers.Layer.WMS(
    "Imagery",
      "http://geo.entrix.com/geoserver/wms/kml?layers=cite:poles",
      {
        layers: 'basic'
      }
  );
			
  poles = new OpenLayers.Layer.Vector("Poles", {
    strategies: [new OpenLayers.Strategy.BBOX()],
    protocol: new OpenLayers.Protocol.HTTP({
		
    url: "http://geo.entrix.com:80/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=Jeff:mec_gps_2010029_data_join&bbox=-82.134,27.544,-81.968,27.678&width=299&height=512&srs=EPSG:63266405&format=application/vnd.google-earth.kml+xml",
    format: new OpenLayers.Format.KML({
      extractAttributes: true
    })
  })
});

/*			
  poles = new OpenLayers.Layer.Vector("Poles", {
    strategies: [new OpenLayers.Strategy.BBOX()],
    protocol: new OpenLayers.Protocol.WFS({
      url: "http://geo.entrix.com/geoserver/wfs",
      srsName: "EPSG:63266405",
      featurePrefix: "Jeff",
      typeName: "mec_gps_2010029_data_join"
    })
  });
*/			
  map.addLayers([base,poles]);
  map.addControl(new OpenLayers.Control.LayerSwitcher());
 map.zoomToMaxExtent();
}



More information about the Users mailing list