[OpenLayers-Users] yet another spherical mercator / geographic question

Lehtonen, Mika mika at digikartta.net
Wed Nov 5 01:32:52 EST 2008


Hi,
can't say what's wrong, but I became curious about what/where the 
terraservice layer is?

- mika -

Andrew Schuh kirjoitti:
> I have managed to get all of my data in EPSG900913 believing that would help
> me overlay on google imagery but I still have a nagging problem.  I have a
> vector data source representing some polygons.  These display very
> accurately against google imagery at very high zoom levels, several hundred
> meters across in window.  As one zooms out, it becomes just slightly offset
> to the south, several hundred miles in window.  Not terrible, but definitely
> noticeable to a user, especially when the polygons are sandwiched up against
> a river bank.  The basics of the code are below.  Is this an error in my
> coding or a limit of what one can do w/ overlaying on the spherical mercator
> imagery?
>
> function initmap(){
>   var options = {
>       projection: new OpenLayers.Projection("EPSG:900913"),
>       displayProjection: new OpenLayers.Projection("EPSG:900913"),
>       units: "m",
>       maxResolution: 156543.0339,
>       maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
> 20037508.34, 20037508.34),
>       numZoomLevels:22
>     };
>
>   map = new OpenLayers.Map('map', options);
>    var gsat = new OpenLayers.Layer.Google(
>                 "Google Satellite",
>                 {type: G_SATELLITE_MAP,
>                  sphericalMercator: true }
>             );
>
>
> OpenLayers.loadURL("/rcbra/web/content/maps/DecisionUnits.geojson",
> 			null,
> 			this,
> 			onGeoJsonLoadSuccess,
> 			onGeoJsonLoadFailure
> 	);
> 			      	     
>
> function onGeoJsonLoadSuccess(data) {
> 	var geojson_format = new OpenLayers.Format.GeoJSON();
> 	var pizzastores = new OpenLayers.Layer.Vector("GeoJSON Layer");  
>         map.addLayer(pizzastores);
>         //alert(data.responseText);
>         pizzastores.addFeatures(geojson_format.read(data.responseText));
> }
>
> function onGeoJsonLoadFailure(data) {
>    
> }
>
>     map.addLayers([gsat,terraservice]);
>     map.addControl(new OpenLayers.Control.ZoomBox());
>     map.addControl(new OpenLayers.Control.LayerSwitcher());
>     map.addControl(new OpenLayers.Control.MousePosition());
>     map.addControl(new OpenLayers.Control.Permalink());
> }
>   



More information about the Users mailing list