0

Trying to get this code working with one OSM layer and one yahoo layer for OpenLayers 3 and Geoserver. Anyone have any idea where the problem migth be?

If I remove everything with the yahoo map, it all works fine (with only OSM map), however, i need the yahoo map to work as well. Please help :)

P.s. src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers" script is loaded at the top, do not know if this might be the problem? Wrong script?

Open street Maps and Geoserver

<script>
//Defining projections
    var geographic = new OpenLayers.Projection("EPSG:4326");
    var mercator = new OpenLayers.Projection("EPSG:900913");

//Defining bounds    
    var world = new OpenLayers.Bounds(-180, -89, 180, 89).transform(
        geographic, mercator
    );
//Defining map center    
    var lund_center = new OpenLayers.LonLat(13.19, 55.71).transform(
        geographic, mercator
    );

    var options = {
        projection: mercator,
        displayProjection: geographic,
        units: "m",
        maxExtent: world,
        maxResolution: 156543.0399,

    };


//Defining main variables  
    var map = new OpenLayers.Map("map", options, { controls: [] });


    var osm = new OpenLayers.Layer.OSM();
    var yLayer = new OpenLayers.Layer.Yahoo("Hybrid");


    map.addLayer(osm);
    map.addLayer(yLayer);

//List of layers 

    var roads_wms = new OpenLayers.Layer.WMS(
        "Roads",
        "http://localhost:8080/geoserver/wms",
        {
            layers: "lu:vagar_alla",
            transparent: "true",
            format: "image/png"
        },
        {isBaseLayer: false, visibility: true}
    );
    map.addLayer(roads_wms);


    var raildroads_wms = new OpenLayers.Layer.WMS(
        "Railroads",
        "http://localhost:8080/geoserver/wms",
        {
            layers: "lu:railroads",
            transparent: "true",
            format: "image/png"
        },
        {isBaseLayer: false, visibility: true}
    );
    map.addLayer(raildroads_wms);


    var buildings_wms = new OpenLayers.Layer.WMS(
        "Official buildings",
        "http://localhost:8080/geoserver/wms",
        {
            layers: "lu:bygg_off",
            transparent: "true",
            format: "image/png"
        },
        {isBaseLayer: false, visibility: true}
    );
    map.addLayer(buildings_wms);

    var other_build_wms = new OpenLayers.Layer.WMS(
        "Other buildings",
        "http://localhost:8080/geoserver/wms",
        {
            layers: "lu:bygg_ovr",
            transparent: "true",
            format: "image/png"
        },
        {isBaseLayer: false, visibility: true}
    );
    map.addLayer(other_build_wms);




   ///////////////////////////////////////




//Map center and zoom
    map.setCenter(lund_center, 14);

//List of controls    
    map.addControl(new OpenLayers.Control.LayerSwitcher());
    map.addControl(new OpenLayers.Control.KeyboardDefaults());          
    map.addControl(new  OpenLayers.Control.Navigation());
    map.addControl(new OpenLayers.Control.ScaleLine());

//Coordinates of mouse position
    map.addControl(new OpenLayers.Control.MousePosition()); 






</script>

1

I believe Yahoo maps closed shop.

http://api.maps.yahoo.com fails a DNS check so the server is down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.