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.

I am using a custom map with the TMS in OpenLayers. I know my high/low latitude and longitude points. In other words I know the exact bounds of my map image in Lat/Long.

Is there a way to use lat/long in the bounds? Or do I have to convert to mercator? My bounds are pretty small - it only covers maybe 10 square miles and then I want to be able to draw circles on the map at specific lat long locations - like draw a circle to highlight a gas station.

I am just a bit confused about the Bounds portion. here is my code this far - use they mercator bounds just to get my image to display.

    function loadmap() {

    var get_my_url = function (bounds) {
        var res = this.map.getResolution();
        var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
        var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
        var z = this.map.getZoom();

        var path = z + "_" + x + "_" + y + "." + this.type;
        var url = this.url;
        if (url instanceof Array) {
            url = this.selectUrl(path, url);
        }
        return url + path;
    }


    var options = {
        maxExtent: new OpenLayers.Bounds(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892),
        numZoomLevels: 5,
        units: 'm',
        projection: "EPSG:900913",
        displayProjection: new OpenLayers.Projection("EPSG:4326")
    };

    var map = new OpenLayers.Map(
    'wissmap',
    options
);

    var layer = new OpenLayers.Layer.TMS(
    'Aerial',
    '/custom/maps/',
    {
        type: 'jpg',
        getURL: get_my_url
    }
);



    map.addLayer(layer);
    map.setCenter([2048, 2048], 2);
}
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Bounds is like a shape of a rectangle with two edges meaning two coordinates,no matter how it is small,It is still a rectangle.

If you go on with smaller bounds,I suggest that you can use center coordinate of bound object which can be calculated from OpenLayers functionality.

See getCenterLonLat function for OpenLayers.Bounds

share|improve this answer
    
thank you this worked –  cmikel Aug 12 '13 at 14:33
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.