Create specify location map.

Hi All,

I want to set Map of Indonesia as my default index page.this is my site : http://www.osmosa.net/map1.html
i have change bound to : 92.8,-13.3,143.3,8.3 it’s bound of indonesia.

But still apear doesn’t work

Help me please,

This is my code


<html> 
  <head> 
    <title>OpenLayers Demo</title>
    <style type="text/css">
      html, body, #basicMap {
          width: 100%;
          height: 100%;
          margin: 0;
      }
    </style>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script>
      function init() {
           var options = {
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                units: "m",
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(92.8,-13.3,143.3,8.3),
                                              
                numZoomLevels: 20,
                controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoomBar(),
                        new OpenLayers.Control.Permalink(),
                        new OpenLayers.Control.ScaleLine(),
                        new OpenLayers.Control.MousePosition(),
                        new OpenLayers.Control.KeyboardDefaults()
 
                  ]
            };
        map = new OpenLayers.Map("basicMap",options);
        var newL = new OpenLayers.Layer.OSM("Default", "/osm_tiles2/${z}/${x}/${y}.png", {numZoomLevels: 19});
        map.addLayer(newL);
        map.zoomIn();
      }
    </script>
  </head>
  <body onload="init();">
    <div id="basicMap"></div>
  </body>
</html>

Meanwhile you found out yourself. Well done.

i change on


map.zoomIn();


to




 if (!map.getCenter()) {
           var center = new OpenLayers.LonLat(116.97,-2.56);
            center.transform(options.displayProjection, options.projection);
            map.setCenter(center, 5);
         }


Thanks for all, especially for you greencaps.Now my tiles have already done.Let see www.osmosa.net

:slight_smile:

Your persistence paid off.

Nice that one can make permalinks too.

Like for Surabaya: http://www.osmosa.net/map.html?zoom=10&lat=-7.26134&lon=112.74301&layers=B

So now you are going to add more tile layers?