[OpenLayers-Users] setCenter(), maxExtent is null error, Spherical Mercator Example documentation

Ted Spradley tspradley at snoogems.com
Tue Sep 8 14:51:15 EDT 2009


Ah!  Thanks much Chris!  

Worked like a charm.  Obvious now that setCenter can not act with no layer
to act upon.  

Thanks again, Ted S.



> 
> 
>       var proj = new OpenLayers.Projection("EPSG:4326");
>       var point = new OpenLayers.LonLat(-95.422899,29.737651);
>       map.setCenter(point.transform(proj, map.getProjectionObject()));
> 
>       map.addLayer(layer);

^^ Add the layer first, then set the center.

       map.addLayer(layer);
       map.setCenter(point.transform(proj, map.getProjectionObject()));
 

-- Chris

>       map.zoomToMaxExtent();
> 
>       </script>
>     </body>
> </html>
> 
>                                               End html page
> #######################################################################

-- 
View this message in context: http://n2.nabble.com/setCenter-maxExtent-is-null-error-Spherical-Mercator-Example-documentation-tp3604502p3605331.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list