[Spanish] GXP: problemas centrar mapa.

shiguera shiguera at osgeo.org
Fri Jan 18 05:47:16 PST 2013


Así, a bote pronto, esas coordenadas mercator negativas.... 

El vie, 18-01-2013 a las 10:16 -0300, javier Diaz escribió:
> Buen dia amigos. Estoy teniendo problemas para definir el center de mi
> map usando GXP.
> Hasta ahora venia usando openlayers + extjs + geoext. de la siguiente manera:
> 
> map = new OpenLayers.Map();
> 
> var options = {
>                 projection: new OpenLayers.Projection("EPSG:900913"),
>                 displayProjection: new OpenLayers.Projection("EPSG:4326"),
>                 units: "m",
>                 numZoomLevels: 18,
>                 controls: [],
>                 maxResolution: 156543.0339,
>                 maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
>                                                  20037508, 20037508.34)
> 
>             };
> map = new OpenLayers.Map(options);
> 
> mapPanel = new GeoExt.MapPanel({
>                 title: "2D Map",
>                 region: "center",
>                 map: map,
>                 id: "mappanel",
>                 split: true,
>                 center: new OpenLayers.LonLat(-58.27681,
> -34.73693).transform(map.displayProjection,  map.projection),
>                 zoom: 10,
>                 ........
>             });
> 
> Con lo cual no tenia problemas para trabajar con las capas propias y
> las de de OSM o las de Google.
> Ahora estoy haciendo algunos cambios para poder usar GXP, pero no
> consigo centrar el map. aqui parte del código:
> 
>     map: {
>             id: "mymap",
>             title: "Mapa2",
>             projection: new OpenLayers.Projection("EPSG:900913"),
>             displayProjection: new OpenLayers.Projection("EPSG:4326"),
>             center: center,
>             //center: [0, 0],
>             zoom: 2,
>             units: "m",
>             numZoomLevels: 18,
>             //maxResolution: 156543.0339,
>             //maxExtent: maxExtent,
>             layers: [
>                 {
>                     source: "osm",
>                     name: "mapnik",
>                     group: "background",
>                 },
>                 {
>                 source: "ol",
>                 group: "background",
>                 fixed: true,
>                 type: "OpenLayers.Layer",
>                 args: ["Sin capa base",
>                     {
>                     visibility: false
>                     }]
>                 }]
>             }
> 
>     .................
>     maxExtent.push ({
>             maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
> 20037508, 20037508.34)
>         });
> 
>     center.push ({
>             center: new OpenLayers.LonLat(-58.27681,
> -34.73693).transform(app.map.displayProjection,  app.map.projection)
>             });
> 
> Con las propiedades  "maxResolution" y  "maxExtent" comentadas el mapa
> se centra en [0,0]. si las descomento, no se carga la aplicación. :@
> Alguien me echa una manito con esto?
> _______________________________________________
> Spanish mailing list
> http://lists.osgeo.org/mailman/listinfo/spanish
> http://es.osgeo.org
> http://twitter.com/osgeoes





More information about the Spanish mailing list