I am using the following code, but no deal. What wrong tree am I barking
up here? Also, I would like to add popup windows to each marker to show
the "cn" and "nt" values in the popup. Pointers to that would also be
muchly appreciated.
var C = {
"init": function() {
var map = new OpenLayers.Map("map");
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{"type": google.maps.MapTypeId.TERRAIN}
);
map.addLayers([gphy]);
C.vector(map);
/*
Google.v3 uses EPSG:900913 as projection, so we have to
transform our coordinates
*/
map.setCenter(new OpenLayers.LonLat(0, 0).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 2);
},
"vector" : function(map) {
var vector = new OpenLayers.Layer.Vector("Vector Layer");
var features = [];
for (var i = 0; i < C.points.length; i++) {
features.push(
new OpenLayers.Format.GeoJSON({
"internalProjection": map.baseLayer.projection,
"externalProjection": new OpenLayers.Projection("EPSG:4326")
}).read({
"type" : "Feature",
"id" : i,
"crs" : null,
"properties": {},
"geometry" : {
"type" : "Point",
"coordinates" : [C.points[i].lo, C.points[i].la]
}
})
);
}
vector.addFeatures(features);
map.addLayer(vector);
},
"points": [
{"ci":1,"cn":"Foo","la":34.5167,"lo":69.1833,"nt":"Good to be foo"},
{"ci":2,"cn":"Bar","la":41.3167,"lo":19.8167,"nt":"Bla bla bar"},
{"ci":3,"cn":"Baz","la":36.7500,"lo": 3.0500,"nt":"Hello, my name
is Baz"},
..
]
};
--
Puneet Kishor http://punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Fellow http://creativecommons.org/about/people/fellows#puneetkishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
---------------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
===========================================================================
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users