[Spanish] conocer coordenadas EPSG:900913

bv2musae at uco.es bv2musae at uco.es
Wed Sep 1 08:59:15 EDT 2010


Resulta que ando intentando crear un sencillo ejemplo con OpenLayers.  
He partido de uno que he encontrado por la red y va bien, pero el  
problema es que se encuentra centrado en EEUU (ver adjunto donde he  
pegado parte del código). Se supone que esas coordenadas deben ser en  
EPSG:900913. Me gustaría centrarlo en la Península Ibérica, pero,  
¿como sé cuáles son sus coordenadas? He intentado de mil maneras poder  
visualizar en gvSIG una capa en el citado EPSG, pero no he sido capaz.

¿Alguien puede ayudarme?
------------ próxima parte ------------
<script type="text/javascript">

        // make map available for easy debugging
        var map;

        // avoid pink tiles
        OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
        OpenLayers.Util.onImageLoadErrorColor = "transparent";

        function init(){
            var options = {
                projection: "EPSG:900913",
                units: "m",
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                                 20037508, 20037508.34)
            };
            map = new OpenLayers.Map('map', options);

            // create Google Mercator layers
            var gsat = new OpenLayers.Layer.Google(
                "Google Sattelite",
                {type: G_SATELLITE_MAP, 'sphericalMercator': true}
            );

            // create WMS layer
            var wms = new OpenLayers.Layer.WMS("OpenLayers WMS",
                                                "http://labs.metacarta.com/wms/vmap0",
                                                {layers: 'basic'}
                                               );


            bounds = new OpenLayers.Bounds();
            bounds.extend(new OpenLayers.LonLat(-14323687.602271,2123114.897454));
            bounds.extend(new OpenLayers.LonLat(-6760702.276977,7132491.982254));
            // include other important locations here if you add features to the map

            // add the created layers to the map (if you want custom layers to show up they must be here as well)
            map.addLayers([gsat, wms]);
            var control = new OpenLayers.Control.LayerSwitcher();
            map.addControl(control);
            /*console.log("BBox is: " + bounds.toBBOX());*/
            map.zoomToExtent(bounds);
			control.maximizeControl();
        }

        function osm_getTileURL(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 limit = Math.pow(2, z);

            if (y < 0 || y >= limit) {
                return OpenLayers.Util.getImagesLocation() + "404.png";
            } else {
                x = ((x % limit) + limit) % limit;
                return this.url + z + "/" + x + "/" + y + "." + this.type;
            }
        }

		map.addLayers([gsat, wms]);
    </script>


More information about the Spanish mailing list