AW: [OpenLayers-Users] Shapefile overlay on OSM or google

Andreas Hocevar ahocevar at opengeo.org
Wed Mar 28 02:34:27 EDT 2012


Hi,

you need to specify a maxExtent on the overlay layer.

Andreas.
On Mar 27, 2012 9:34 AM, "Arnd Wippermann" <arnd.wippermann at web.de> wrote:

> **
> Hi,
>
> set always mapOptions, if you use a projection other than EPSG:4326.
> Perhaps that solves your problem.
> mapOptions = {
>     projection: new OpenLayers.Projection("EPSG:900913"),
>     //displayProjection: new OpenLayers.Projection("EPSG:4326"),
>     units: "m",
>     numZoomLevels: 18,
>     maxResolution: 5,
>     maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
> 20037508.34, 20037508.34)
> };
> map = new OpenLayers.Map('map', mapOptions);
>
>
> some layers with cities
>
> var gphy = new OpenLayers.Layer.Google(
>     "Google Physical",
>     {type: google.maps.MapTypeId.TERRAIN}
> );
> map.addLayer(gphy);
>
> osmLayer = new OpenLayers.Layer.OSM( "Simple OSM Map");
> map.addLayer(osmLayer);
>
> esriTopo = new OpenLayers.Layer.ArcGIS93Rest( "ESRI Topo",
>             "
> http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/export?f=image
> ",
>             {layers: "show:0"},
>             {isBaseLayer:false, visibility:false}
>         );
>
> esriTopo.setVisibility(true);
> map.addLayers(esriTopo);
> Arnd
>
>
>  ------------------------------
> *Von:* openlayers-users-bounces at lists.osgeo.org [mailto:
> openlayers-users-bounces at lists.osgeo.org] *Im Auftrag von *Ian Dunlop
> *Gesendet:* Dienstag, 27. März 2012 12:59
> *An:* openlayers-users at lists.osgeo.org
> *Betreff:* [OpenLayers-Users] Shapefile overlay on OSM or google
>
> Hello,
>
> I am trying to overlay a shapefile polygon on top of an Open Streetmap or
> google layer.  However, it only shows up when zoomed out and disappears
> when zoomed in to the map. Any ideas why this would be happening? The
> shapefile is being served by gesoserver and overlays correctly at all zoom
> levels on another WMS layer eg
> OpenLayers.Layer.WMS( "OpenLayers WMS", "
> http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
>
>  I have only just started using openlayers so there may be something I am
> missing. If this is not possible then are there any layers in the wild
> which have city names on them (that's all I need really).  Sample code
> below:
>
>                  var map = new OpenLayers.Map('map');
>         var mapLayer = new OpenLayers.Layer.Google();
>         //var mapLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>         //    "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'}
> );
>
> var roads = new OpenLayers.Layer.WFS(
>                "Roads",
>                "http://localhost:8080/geoserver/wfs",
>                {typename: 'topp:tasmania_roads'},
>                {
>                    typename: 'tasmania_roads',
>                    featureNS: 'http://www.openplans.org/topp',
>                    extractAttributes: false
>                }
>            );
>        map.addLayers([mapLayer, roads]);
>
> Cheers,
>
> Ian
>
> --
> Ian Dunlop
> myGrid Team
> School of Computer Science
> University of Manchester
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120328/e85dc629/attachment.html


More information about the Users mailing list