Hello,<div><br></div><div>Finally got around to trying this. It works.  Setting maxExtent on the layer allows it to display on the map. Thanks for the advice.</div><div><br></div><div>Cheers,</div><div><br></div><div>Ian<br>
<br><div class="gmail_quote">On 28 March 2012 07:34, Andreas Hocevar <span dir="ltr">&lt;<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<p>Hi,</p>
<p>you need to specify a maxExtent on the overlay layer.</p>
<p>Andreas.</p>
<div class="gmail_quote"><div><div class="h5">On Mar 27, 2012 9:34 AM, &quot;Arnd Wippermann&quot; &lt;<a href="mailto:arnd.wippermann@web.de" target="_blank">arnd.wippermann@web.de</a>&gt; wrote:<br type="attribution">
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<div><div><div class="h5">
<div dir="ltr" align="left"><font color="#0000ff" face="Arial"><span>Hi,</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial"><span></span></font> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial">set always mapOptions, if you use a projection other than EPSG:4326<span>. Perhaps that solves your problem.</span><br>
</font></div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial">mapOptions = {<br>
    projection: new OpenLayers.Projection(&quot;EPSG:900913&quot;),<br>
    //displayProjection: new OpenLayers.Projection(&quot;EPSG:4326&quot;),<br>
    units: &quot;m&quot;,<br>
    numZoomLevels: 18,<br>
    maxResolution: 5,<br>
    maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)<br>
};<br>
map = new OpenLayers.Map(&#39;map&#39;, mapOptions);</font></div>
<div> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial"><span></span></font> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial"><span>some layers with cities</span></font></div>
<div><font color="#0000ff" face="Arial"></font> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial">var gphy = new OpenLayers.Layer.Google(<br>
    &quot;Google Physical&quot;,<br>
    {type: google.maps.MapTypeId.TERRAIN}<br>
);<br>
map.addLayer(gphy);</font></div>
<div> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial">osmLayer = new OpenLayers.Layer.OSM( &quot;Simple OSM Map&quot;);<br>
map.addLayer(osmLayer);</font></div>
<div> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial">esriTopo = new OpenLayers.Layer.ArcGIS93Rest( &quot;ESRI Topo&quot;,<br>
            &quot;<a href="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/export?f=image" target="_blank">http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/export?f=image</a>&quot;,<br>

            {layers: &quot;show:0&quot;}, <br>
            {isBaseLayer:false, visibility:false}<br>
        );</font></div>
<div> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial">esriTopo.setVisibility(true);<br>
map.addLayers(esriTopo);<br>
</font></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Arnd</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<br>
<div dir="ltr" lang="de" align="left">
<hr>
<font face="Tahoma"><b>Von:</b> <a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">
openlayers-users-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>]
<b>Im Auftrag von </b>Ian Dunlop<br>
<b>Gesendet:</b> Dienstag, 27. März 2012 12:59<br>
<b>An:</b> <a href="mailto:openlayers-users@lists.osgeo.org" target="_blank">openlayers-users@lists.osgeo.org</a><br>
<b>Betreff:</b> [OpenLayers-Users] Shapefile overlay on OSM or google<br>
</font><br>
</div>
<div></div></div></div><div><div class="h5">
Hello,
<div><br>
</div>
<div>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 </div>
<div>OpenLayers.Layer.WMS( &quot;OpenLayers WMS&quot;, &quot;<a href="http://vmap0.tiles.osgeo.org/wms/vmap0" target="_blank">http://vmap0.tiles.osgeo.org/wms/vmap0</a>&quot;, {layers: &#39;basic&#39;} );</div>
<div><br>
</div>
<div>
<div>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&#39;s all I need really).  Sample code below:</div>

<div><br>
</div>
<div>
<div>                var map = new OpenLayers.Map(&#39;map&#39;);</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>        var mapLayer = new OpenLayers.Layer.Google();</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>        //var mapLayer = new OpenLayers.Layer.WMS( &quot;OpenLayers WMS&quot;,</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>        //    &quot;<a href="http://vmap0.tiles.osgeo.org/wms/vmap0" target="_blank">http://vmap0.tiles.osgeo.org/wms/vmap0</a>&quot;, {layers: &#39;basic&#39;} );</div>
<div><br>
</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>var roads = new OpenLayers.Layer.WFS(</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>               &quot;Roads&quot;, </div>
<div><span style="WHITE-SPACE:pre-wrap"></span>               &quot;<a href="http://localhost:8080/geoserver/wfs" target="_blank">http://localhost:8080/geoserver/wfs</a>&quot;,</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>               {typename: &#39;topp:tasmania_roads&#39;},</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>               {</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>                   typename: &#39;tasmania_roads&#39;, </div>
<div><span style="WHITE-SPACE:pre-wrap"></span>                   featureNS: &#39;<a href="http://www.openplans.org/topp" target="_blank">http://www.openplans.org/topp</a>&#39;, </div>
<div><span style="WHITE-SPACE:pre-wrap"></span>                   extractAttributes: false</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>               }</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>           );</div>
<div><span style="WHITE-SPACE:pre-wrap"></span>       map.addLayers([mapLayer, roads]);</div>
</div>
<div><br>
</div>
<div>Cheers,</div>
<div><br>
</div>
<div>Ian</div>
<div><br>
</div>
-- <br>
Ian Dunlop<br>
myGrid Team<br>
School of Computer Science<br>
University of Manchester<br>
</div>
</div></div></div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br>
</blockquote>
</div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>Ian Dunlop<br>myGrid Team<br>School of Computer Science<br>University of Manchester<br>
</div>