new OpenLayers.Control.Permalink(permalink)
],
displayProjection: new OpenLayers.Projection("EPSG:4326"),
+ maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
+ projection: "EPSG:900913",
+ units: "m",
+ maxResolution: 156543.0339,
numZoomLevels: 18
});
+ if (options.mapurl) {
+ var newLayer = new OpenLayers.Layer.OSM("Local Tiles", options.mapurl, {numZoomLevels: 19, isBaseLayer: true});
+ map.addLayer(newLayer);
+ } else {
+ map.addLayer(new OpenLayers.Layer.OSM());
+ }
- map.addLayer(new OpenLayers.Layer.OSM());
+ // this nightmare is possible through http://docs.openlayers.org/library/spherical_mercator.html
+ if (options.google_apikey && options.google_apikey != 'null') {
+ googleLayer = new OpenLayers.Layer.Google(
+ "Google Hybrid",
+ {type: G_HYBRID_MAP,
+ 'sphericalMercator': true,
+ 'maxExtent': new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
+ projection: new OpenLayers.Projection("EPSG:3857")}
+ );
+ map.addLayer(googleLayer);
+ }
if (options.format == 'CSV') {
pois = new OpenLayers.Layer.Text( "CSV",
- { location:"/" + options.map + "/pois.txt",
- projection: map.displayProjection
+ { location: options.csvurl,
+ projection: new OpenLayers.Projection("EPSG:4326")
});
} else if (options.format == 'GeoJSON') {
pois = new OpenLayers.Layer.Vector("GeoJSON", {
protocol: new OpenLayers.Protocol.HTTP({
- url: "/" + options.map + "/pois.json",
+ url: options.jsonurl,
format: new OpenLayers.Format.GeoJSON()
}),
- strategies: [new OpenLayers.Strategy.Fixed()]
+ strategies: [new OpenLayers.Strategy.Fixed()],
+ projection: new OpenLayers.Projection("EPSG:4326")
});
} else {
pois = new OpenLayers.Layer.Vector("KML", {
protocol: new OpenLayers.Protocol.HTTP({
- url: "/" + options.map + "/pois.kml",
+ url: options.kmlurl,
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
}),
- strategies: [new OpenLayers.Strategy.Fixed()]});
+ strategies: [new OpenLayers.Strategy.Fixed()],
+ projection: new OpenLayers.Projection("EPSG:4326")
+ });
}
map.addLayer(pois);
select = new OpenLayers.Control.SelectFeature(pois);