[OpenLayers-Users] labels on feature help
ulao
S_K_U_N_X at yahoo.com
Mon Aug 2 12:01:07 EDT 2010
I tried to make a simple app and now I have a strange issue. See the alert.
The strange thing is this code works in the live example so it must be a
typeO or html error I can not spot.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<script src="OpenLayers.js"></script>
<script type="text/javascript">
document.write('<script type="text/javascript"
src="http://maps.Google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg"></scr'
+ 'ipt>');
var map,glayer,lineLayer;
function init(){
map = new OpenLayers.Map('map');
glayer = new OpenLayers.Layer.Google( "Google Streets" , {type:
G_NORMAL_MAP ,numZoomLevels: 22 });
map.addLayer(glayer);
map.addLayer(layer);alert("ie wont get here, ff does? Even
though ff does it still didnt create the layer right");
var points = new Array(new OpenLayers.Geometry.Point(17.99,59.3) )
points[1] = new OpenLayers.Geometry.Point(1,1)
points[2] = new OpenLayers.Geometry.Point(100,100)
var obj = new OpenLayers.Geometry.LineString(points);
var newFeature = new OpenLayers.Feature.Vector( obj );
newFeature.style =
{
strokeWidth: 14,
label: "test",
fontColor: "green",
fontSize: "20px",
fontFamily: "Arial",
labelAlign: "cb",
fillOpacity: 1
};
lineLayer.addFeatures(newFeature)
map.setCenter(new OpenLayers.LonLat(17.99,59.3) );
//map.zoomTo(10);
}
</script>
</head>
<body onload="init()">
<div id="map" class="smallmap"></div>
</body>
</html>
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/labels-on-feature-help-tp5355089p5364604.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list