Openlayers text layer is not working

المشرف العام

Administrator
طاقم الإدارة
I am trying to load markers from a text file using openlayers text layer, but no marker is shown, text file and icons are in same directory. However I am able to show markers using marker layer. My code is here and text file is also attached, kindly help me out.

function init(){ /*Create a new Map with Basic controls which are passed asarguments*/var map= new OpenLayers.Map('map_element',{ controls:[ new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.LayerSwitcher(), //new OpenLayers.Control.Attribution() ], numZoomLevels:19, units:'m'}); // default lan/lat projection in which points will be provided var epsg4326 = new OpenLayers.Projection("EPSG:4326"); /* Create Basic Layers to show on map*/// openstreetmap layervar osm_map_layer = new OpenLayers.Layer.OSM ('Open Street Maps');// google map layervar google_map_layer = new OpenLayers.Layer.Google('Google Street Maps',{sphericalMercator: true,maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34, 20037508.34, 20037508.34)});/*vector layer to draw custom shapes on map*/var vectors = new OpenLayers.Layer.Vector("Vectors");/*markers layer will be used to insert markers on map*/var markers = new OpenLayers.Layer.Markers( "Markers"); /* layers are added to map*/pois = new OpenLayers.Layer.Text( "My points", { location:"./pois.txt", projection: map.displayProjection});map.addLayer(pois);map.addLayers([osm_map_layer,//google_map_layer,//vectors,markers,pois]); //var lonlat = new OpenLayers.LonLat(48.9459301,9.6075669);lonlat.transform(epsg4326, map.getProjectionObject());map.setCenter(lonlat, 15);markers.addMarker(new OpenLayers.Marker(lonlat));} // last closing bracketand text file

lat lon title description icon iconSize

iconOffset
48.9459301 9.6075669 Title One Description

one
Second line.

(click again to close)

Ol_icon_blue_example.png 24,24 0,-24
48.9899851 9.5382032 Title Two Description

two. Ol_icon_red_example.png 16,16 -8,-8



أكثر...
 
أعلى