[OpenLayers-Users] Overlay tiger data on top of google maps, fail

Anne Blankert anne.blankert at geodan.nl
Wed Aug 18 11:16:36 EDT 2010


  Hi,

I believe you cannot overlay EPSG:4269 on top of EPSG:900913 without 
reprojection, because these are different coordinate systems.

Google maps uses a fixed projection: spherical mercator (EPSG:900913 
alias EPSG:3857 alias EPSG:102113). This projection cannot be changed.
Your openlayers code uses google maps as a base layer and thus will send 
requests to overlay layers using the base layer projection 
(epsg:900913). Google maps can only be used as base layer and so your 
overlay layers must be made to support spherical mercator.

If you want to overlay with some other dataset such as Tiger, you should 
reproject the other dataset to spherical mercator. If the source data is 
EPSG:4269, then you can either reproject on the fly by adding a 
rendering projection in the map rendering software or you should 
reproject the source data.

The problem is not in openlayers but in the geoserver configuration, 
where you should try to make the tiger data to render in epsg:900913.

Anne

On 8/3/2010 3:58 PM, Alessandro Ferrucci wrote:
> Hello,
> I have a map.  Base layer is standard google maps, SRS of map is 
> EPSG:900913.  I have a PostGIS database with Tiger state boundaries, 
> native SRS is EPSG:4269.
>
> I would like to overlay the tiger data on top of google maps.
>
> Here is the entire HTML/Javascript snippet:
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>WMS Reprojection Example</title>
> <script src="http://openlayers.org/api/OpenLayers.js" 
> type="text/javascript"></script>
> <script 
> src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true_or_false&amp;key=ABQIAAAAo2c5r7VgSxo43IHrZeBAoBTWcxCzB35ZqF_ujzxzX_fuKZ1t-BRfAjPqLC0WSahNI2hYIsaJL6PKVA 
> <http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true_or_false&amp;key=ABQIAAAAo2c5r7VgSxo43IHrZeBAoBTWcxCzB35ZqF_ujzxzX_fuKZ1t-BRfAjPqLC0WSahNI2hYIsaJL6PKVA>" 
> type="text/javascript"></script>
> <script defer="defer" type="text/javascript">
>             function init()
>             {
>                 var mercator = new OpenLayers.Projection("EPSG:900913");
>                 var geographic = new OpenLayers.Projection("EPSG:4269");
>                 var maxExt = new OpenLayers.Bounds( -20037508, 
> -20037508, 20037508, 20037508 );
>
>                 map = new OpenLayers.Map(
>                     'map',
>                     {
>                         projection: mercator,
>                         displayProjection: geographic,
>                         units: 'm',
>                         maxResolution: 156543.0039,
>                         maxExtent: maxExt
>                     }
>                 );
>
>                 var googleLayer = new OpenLayers.Layer.Google(
>                     "Google Layer",
>                     {spericalMercator: true}
>                 );
>
>                 var wms = new OpenLayers.Layer.WMS(
>                     "State Boundaries WMS",
>                     "http://localhost:8080/geoserver/wms",
>                     {
>                         layers: "state_boundaries",
>                         srs: 'EPSG:4269',
>                         format:'image/png8',
>                         transparent:'true',
>                         tiled: 'true'
>                     },
>                     {'isBaseLayer': false}/*,
>                     { projection: "EPSG:4269" }*/
>                 );
>
>                 map.addLayer( googleLayer );
>
>                 map.addLayer( wms );
>
>                 var ddBounds = new OpenLayers.Bounds( -73.839111, 
> 40.287907, -68.214111, 44.441624 );
>                 map.zoomToExtent( ddBounds.transform(geographic, 
> mercator) );
>             }
> </script>
> </head>
>
> <body onload="init()">
> <div style="width:100%; height:100%; background-color: #99B3CC" 
> id="map"></div>
> </body>
>
> </html>
>
> An interesting point is.
>
> All the WMS requests that are made to my local geoserver instance do 
> in fact return blank tiles.
>
> When I look at all the WMS requests there are google WMS requests and 
> WMS requests to my local host for the "wms" layer.  The local WMS 
> requests look like this:
>
>
> http://localhost:8080/geoserver/wms?LAYERS=state_boundaries&STYLES=stateBoundaries&SRS=EPSG%3A900913&FORMAT=image%2Fpng8&TRANSPARENT=true&TILED=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=-88,32.9375,-85.1875,35.75&WIDTH=256&HEIGHT=256 
> <http://localhost:8080/geoserver/wms?LAYERS=state_boundaries&STYLES=stateBoundaries&SRS=EPSG%3A900913&FORMAT=image%2Fpng8&TRANSPARENT=true&TILED=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=-88,32.9375,-85.1875,35.75&WIDTH=256&HEIGHT=256>
>
> Notice the SRS=EPSG%3A900913
>
> When I change this URL to have SRS=EPSG%3A4269  I get snippets of 
> state boundaries but they look stretched vertically.
>
> Any thoughts/ideas?
> thank you
>
> -- 
> Signed,
> Alessandro Ferrucci
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100818/79ab8449/attachment.html


More information about the Users mailing list