Hi,
I found a script on the internet drawing markers specified in a a tex-tfile on an OpenStreetview Map using Openlayers (see code below). The code works fine and I am about to understand how the whole thing works as I do not have any experience concerning Openlayers and Openstreetmaps, yet.
I was wondering whether there is a similar solution for connecting lines? As I was browsing the API, I could not find a suitable answer as it’s all Greek for me at the moment.
What I actually want to do is visualize networks on a map. Is there a simple way of drawing like 100 lines on a map whose starting and ending points are defined in a text-file?
Can anybody provide me with an example that can serve me as a basis?
Thank you for your support!
<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:"./textfile.txt",
projection: map.displayProjection
});
map.addLayer(pois);
var lonLat = new OpenLayers.LonLat( 40.5788, 40.9773 )
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator Projection
); var zoom=1;
map.setCenter (lonLat, zoom);
</script>
</body></html>