I am building an openstreetmap with some geometry points, using this example, and using the OpenLayers.mobile.js.
map = new OpenLayers.Map({
div: "mapdiv",
theme: null,
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0399,
numZoomLevels: 19,
units: 'm',
controls: [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.TouchNavigation({
dragPanOptions: {
enableKinetic: true
}
}),
new OpenLayers.Control.Zoom()
]
});
map.addLayer(new OpenLayers.Layer.OSM());
map.zoomToMaxExtent();
var style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
style.graphicWidth = 30;
style.graphicHeight = 32;
style.externalGraphic = "img/point.png";
var mapmarkers = new OpenLayers.Layer.Vector( "Markers");
var features = [];
var points = [];
map.addLayer(mapmarkers);
for (var i = markers.length - 1; i >= 0; i--) {
points[i] = new OpenLayers.Geometry.Point( markers[i].latlng[0], markers[i].latlng[1] );
features[i] = new OpenLayers.Feature.Vector( points[i], null, style);
}
mapmarkers.addFeatures(features);
map.setCenter(new OpenLayers.LonLat(points[0].x, points[0].y), 5);
I'm getting the correct number of points on the map, but they are sitting at a lat/lang of 0,0. The only difference between the features
variable I'm sending to addFeatures
.. features.geometry
is that it has a bounds object with top/bottom/right/left equivalent to the x and y that isn't present in the example..
If I use the example's map.addLayer(new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} ));
both points get placed but they are in Antarctica instead of Quebec (at least in different places then)
asked
30 Jan '13, 16:27
thedamon
26●1●1●2
accept rate:
0%
You will have better chances of getting an answer if you rephrase this as an actual question.