Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Background

My site is built on ArcGIS Server 10 with the JavaScript API 2.3, and uses Bing Maps as the background mapping. Although the site is aimed at NSW, Australia we allow the user to zoom anywhere in the world, at any of the supported scales (ie, the tiling scheme as specified in the ArcGIS Help File.)

Bing Maps road/satellite datasets are available at varying scale ranges, with populated areas supporting larger scales than empty rural areas. When zooming somewhere with no map/satellite data, a "broken camera" icon is shown. We'd like to avoid showing this ugly icon.

Question

How can we restrict the maximum zoom scale where the map/satellite is not available, but allow full zoom-in where it is available?

Google Maps does this quite well - as you move around the world you can see the Zoom Slider expand/contract depending on what datasets are available at that location. They presumably have metadata showing the presence/absence of data, so how can we emulate this when using Bing Maps, with no access to the metadata?

Thanks

share|improve this question
    
Use the Interactive SDK as in the previous post - gis.stackexchange.com/questions/11285/… –  Mapperz Jun 22 '11 at 14:05
    
Would that require rewriting my entire app in the Bing Maps SDK? If so, it's not really an option since this enhancement is a tiny "nice to have" feature –  Stephen Lead Jun 22 '11 at 23:08
add comment

3 Answers

function getMapServerMetadata(Url) {
    var metadata = "";
    esri.request({
        url: Url + "?f=json",
        handleAs: "json",
        callbackParamName: "callback",
        load: function (response, io) {
            metadata += "Map Name: " + response.mapName;
            metadata += "\n\nCurrent Version: " + response.currentVersion;
            metadata += "\n\nService Description: " + response.serviceDescription;
            metadata += "\n\nCopyright: " + response.copyrightText;
            metadata += "\n\nNumber of Layers: " + response.layers.length;
            metadata += "\n\nNumber of Tables: " + response.tables.length;
            metadata += "\n\nSpatial Reference: " + response.spatialReference.wkid;
            alert(metadata);
        },
        error: function (error) {
            alert(error.message);
        }
    });
}

// Available json objects
//        currentVersion
//        serviceDescription
//        mapName
//        description
//        copyrightText
//        layers
//        tables
//        spatialReference
//        singleFusedMapCache
//        tileInfo
//        initialExtent
//        fullExtent
//        units
//        supportedImageFormatTypes
//        documentInfo
//        capabilities
//        _ssl

e.g. try using the above code with a regular basemap MapServer url from ESRI like: http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer

you can also use this on sublayers as well - to find out what metadata is there just use the base url and add ?f=json to have a json representation returned and iterate through the field names.

share|improve this answer
    
Hi Loran, welcome to GIS.se :) Please add a sentence or two above the code block describing it's purpose and what it does. Many readers won't be able to understand this with cursory review. (I'd also consider putting the list of json objects into columns so the code block doesn't take up as much screen real estate.) –  matt wilkie Jan 25 '13 at 21:07
add comment

Before zooming to a location, perhaps get the image metadata to see what the finest resolution is available there.

Determine the availability of imagery at a location at a specified zoom level

Since the response contains zoomMin and zoomMax, I suppose you could make the call just once at a low res zoom level and use the values from that, otherwise it seems like you might need to make multiple calls.

share|improve this answer
    
Kirk, this looks promising. A problem is that the returned ImageURL parameter may be valid, but show the "broken camera" icon I'm trying to avoid (eg ecn.t3.tiles.virtualearth.net/tiles/…{culture}). I can't see how to "Determine the availability of imagery at a location at a specified zoom level" since the camera icon is technically "available" –  Stephen Lead Jun 23 '11 at 1:15
    
Wow, that sure seems like a poor design decision. Maybe if you convert the broken camera image to bytes then sum up the bytes you can know when you're zoomed too close. –  Kirk Kuykendall Jun 23 '11 at 13:33
add comment

Bing Maps is a tiled map, so has levels of detail when zoomed in or out. I would fire a conditional statement on every extent change. Something like: event fired: Extent Change Conditional: if map style = aerial and (get level < desired): set level back at desired...

share|improve this answer
    
Josh, this also looks promising- but how do I determine the value of "desired"? This will vary across the map –  Stephen Lead Jun 23 '11 at 1:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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