[OpenLayers-Users] Problem with OpenLayers.Layer.Text - php generated textfile

mzetka3@tlen.pl mzetka3 at tlen.pl
Fri Nov 25 07:04:28 EST 2011


Hell,
I've got problem with generating textfiles. I think I'm do everything right. If I paste result  from poi.txt everything work. Please help me!! I'm trying to fix this from two days. here is the code:

--------------------------------poi.html-----------------
<html><body>
  <div id="mapdiv"></div>
  <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
  <script>
    map = new OpenLayers.Map("mapdiv");
    map.addLayer(new OpenLayers.Layer.OSM());
 
    var pois = new OpenLayers.Layer.Text( "My Points",
                    { location:"./poi.php",
                      projection: map.displayProjection
                    });
    map.addLayer(pois);
 
    //Set start centrepoint and zoom    
    var lonLat = new OpenLayers.LonLat( 9.5788, 48.9773 )
          .transform(
            new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
            map.getProjectionObject() // to Spherical Mercator Projection
          );
    var zoom=11;
    map.setCenter (lonLat, zoom);  
 
  </script>
</body></html>


---------------------poi.php---------------
<?php

$poi = array('"lat	lon	title	description	icon	iconSize	iconOffset" . "\n"');
$poi[] = '"54.4422	18.5715	Merryl	Avenue	blue.png	20,34	-21,-3"';
header('Content-Type: text/plain');
$poiOutput = join("\n", $poi);
print ("$poiOutput");
?>




More information about the Users mailing list