[OpenLayers-Users] draw a line on a map?
geoman
csabbey at gmail.com
Tue Apr 15 15:30:38 EDT 2008
Below is my what I ended up with to draw a line.
When I pan the map North and South, the line does not stay fixed relative to
the map - can someone please tell me what the issue is here?
<!-- started with http://pgrouting.postlbs.org/wiki/Workshop-DrawRoute -->
<!-- that page was out of date for the latest OpenLayers - see
http://tainavn.blogspot.com/ for changes -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 762px;
height: 825px;
border: 1px solid black;
}
</style>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script
src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAIeWnOWItAsdtOsR3kxiUQhTwM0brOpm-All5BF6PoaKBxRWWERSQAgEHUq2jStqEx-kpNgzntg87iw"></script>
<script type="text/javascript">
var vector_style = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);
vector_style.strokeWidth = 3;
vector_style.strokeColor = "#000000";
vector_style.fillOpacity = 0;
vector_style.strokeOpacity = .8;
function init() {
var map = new OpenLayers.Map('map');
var google = new OpenLayers.Layer.Google( "Google", { type: G_NORMAL_MAP
} );
var highlight = new OpenLayers.Layer.Vector("highlight", {style:
vector_style});
map.addLayers([google, highlight]);
var parser = new OpenLayers.Format.WKT();
var wkt = "LINESTRING(-73.9444 40.75921,-73.96892 40.76396)";
highlight.addFeatures(parser.read(wkt));
map.zoomToExtent(new
OpenLayers.Bounds(-74.0472500,40.6795100,-73.9071900,40.8820000));
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>
geoman wrote:
>
> There were other issues with my code - I tried to start with an out of
> date example of pgRouting from
> http://pgrouting.postlbs.org/wiki/Workshop-DrawRoute
>
> Here is a page which details some other changes that are necessary to get
> this code to work against version 2.5
> http://tainavn.blogspot.com/
>
>
--
View this message in context: http://www.nabble.com/draw-a-line-on-a-map--tp16689097p16705858.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list