- да, когда я указываю координаты в метрах:Этот последний запрос отправляет OpenLayers?
Код: Выделить всё
map.setCenter(new OpenLayers.LonLat(15563653, 4254704), zoom);- да, когда я указываю координаты в метрах:Этот последний запрос отправляет OpenLayers?
Код: Выделить всё
map.setCenter(new OpenLayers.LonLat(15563653, 4254704), zoom);Код: Выделить всё
<script src="OpenLayers.js"></script>
    <script type="text/javascript">
        <!-- var lon = 139.7245; >
        <!--var lat = 35.6816; >
        var zoom = 11;
        <!--var map, layer, localWMS;>
        function init(){
            var options = {
                    div: "map",
                    projection: "EPSG:3857"
                };
                
            var map = new OpenLayers.Map(options);
            var osm = new OpenLayers.Layer.OSM();
            <!-- var gmap = new OpenLayers.Layer.Google("Google Streets", {visibility: false}); >
            
            var localWMS = new OpenLayers.Layer.WMS( 
                    "Local WMS layers",
                    "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/OSGeo4W/apps/mapserver-tutorial/example12/example.map",
                    {layers: 'mapserver_tutorial_wms_server', transparent: true},
                    {isBaseLayer: true, opacity: 0.9});
            
            <!--map.addLayers([localWMS, osm, gmap]);>
            
            
            map.addLayers([localWMS, osm]); 
            <!-- map.addLayer(osm);>
            
            map.setCenter(new OpenLayers.LonLat(15563653, 4254704), zoom); 
            
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
        }
    </script>
Код: Выделить всё
isBaseLayer: falseКод: Выделить всё
isBaseLayer: true- выводить ошибкуА какой запрос в этом случае уходит к серверу - посмотрите в консоли браузера.
Код: Выделить всё
Uncaught TypeError: Cannot read property 'containsLonLat' of null Код: Выделить всё
var localWMS = new OpenLayers.Layer.WMS( 
                    "Local WMS layers",
			        "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/OSGeo4W/apps/mapserver-tutorial/example12/example.map",
                    {layers: 'mapserver_tutorial_wms_server', transparent: true},
                    {isBaseLayer: false, opacity: 0.9}); // указание слой - не базовый
map.addLayer(localWMS); // добавление слояКод: Выделить всё
var localWMS = new OpenLayers.Layer.WMS( 
                    "Local WMS layers",
			        "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/OSGeo4W/apps/mapserver-tutorial/example12/example.map",
                    {layers: 'mapserver_tutorial_wms_server', transparent: true},
                    {isBaseLayer: true, opacity: 0.9}); // указание слой - базовый
map.addLayer(localWMS); // добавление слояКод: Выделить всё
http://localhost/openlayers.htmlКод: Выделить всё
file:///C:/OSGeo4W/apps/mapserver-tutorial/example14/openlayers.htmlКод: Выделить всё
  <script src="http://openlayers.org/dev/OpenLayers.js"></script>
    <script type="text/javascript">
        var zoom = 11;
        function init(){
            var options = {
                    div: "map",
                    projection: "EPSG:3857",
                 };
                
            var map = new OpenLayers.Map(options);
            var osm = new OpenLayers.Layer.OSM();
            
            var localWMS = new OpenLayers.Layer.WMS( 
                    "Local WMS layers",
			        "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/OSGeo4W/apps/mapserver-tutorial/example12/example.map",
                    {layers: 'mapserver_tutorial_wms_server', transparent: true},
                    {isBaseLayer: false, opacity: 0.9}); // не делаем наш слой ВМС-базовым
                        
            map.addLayers([osm,localWMS]); 
            // map.addLayer(localWMS);
            
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            
            map.setCenter(new OpenLayers.LonLat(15563653, 4254704), zoom);
        }
    </script>Сейчас этот форум просматривают: нет зарегистрированных пользователей и 4 гостя