Why OpenLayers Wrapper cuts map and how to specify the correct location?

I welcome!

Faced with this problem - by using the following code displays the map, not all but cut off at some station -


...
public OpenLayersMap getOpenLayersMap() {
   openLayersMap = new OpenLayersMap() { 
        @Override 
        protected void updateExtent( 
                java.util.Map<String, Object> variables) { 
            super.updateExtent(variables); 
            
            Set keySet = variables.keySet();
            for(Object key : keySet) {
           	 System.out.print(key + " " + variables.get(key));
            } 
        }; 
    }; 
   openLayersMap.setImmediate(true);
   
   wms = new WebMapServiceLayer();       
   wms.setUri("http://localhost:8082/geoserver/wms?service=wms");
   wms.setLayers("MapRZD");
   wms.setFormat("image/png");
   wms.setTransparent(true);
   wms.setBaseLayer(true);
   wms.setCqlFilter("");
   
   openLayersMap.getExtend();
   
   openLayersMap.addLayer(wms);            
   openLayersMap.setSizeFull();
   openLayersMap.setCenter(37.65130, 55.69964);
   openLayersMap.setZoom(7);
   

   return openLayersMap; 
}

...

Take a look -
11997.png

I would like to see both -
11998.png

Does anyone know? :smiley:
I would be very grateful for the information!

Cheers,
Thx

Hi,

The default size of OpenLayersMap component is 500pxx350px. You could make it wider or use relative width: map.setWidht(“100%”);

cheers,
matti

I welcome you, Matti Tahvonen!

Excellent! Geo-information system, largely thanks to your advice is almost ready!:smiley: Thank you so much for helping in the process of working on it!:smiley:
There remains little question - i set the width as you indicated, but the result is the same:


...
public OpenLayersMap getOpenLayersMap() {
   openLayersMap.setImmediate(true);
   
   wms = new WebMapServiceLayer();       
   wms.setUri(wmsGeoServerLayer);
   wms.setLayers(wmsGeoServerLayerName);
   wms.setFormat(wmsGeoServerLayerFormat);
   wms.setTransparent(true);
   wms.setBaseLayer(true);
   wms.setCqlFilter("");
   
   openLayersMap.getExtend();
   
   openLayersMap.addLayer(wms); 	   
   openLayersMap.setSizeFull();
   openLayersMap.setWidth("100%");      
   openLayersMap.setCenter(100.65130, 55.69964);
   openLayersMap.setZoom(3);

   return openLayersMap; 
}

...

12012.png

Hi,

I’d guess the parent component isn’t providing any room for the component so it falls back to the default size. You should probably use setWidth(“100%”) also for the component that contains your map widget (and all its possible parents).

cheers,
matti

I don’t really know OpenLayers, but the map is cut here at the 180 longitude, so this should not be related with the map size.

You might need to set some flag for OpenLayers to enable support for map features that cross the 180 longitude - probably there is such a setting.
It might also be that your data source does not support features crossing the 180 longitude, or might need some special settings for that there.

I welcome you, Matti Tahvonen!
I welcome you, Henri Sara!

Thank you very much for the info!:smiley: Now try it.

I welcome!

So, I did all this - ordered width to 100% for the map and the whole hierarchy of nesting, but the result is not affected, longitude 180 map is still cut off.

I tried to use absolute units -


...
openLayersMap.setWidth("1000px");
...

However, the result is somewhat surprising -
12058.png

If the return -


...
openLayersMap.setWidth("100%");
...

…all still
12059.png

Once again I want to note that the WMS produced by GeoServer include a map of the whole, not trimmed.
The problem is the wrapper.:dry:

Does anyone know?

As Henri noticed, your clipping occurs on dateline. I think the wrapper currently has no Java api for the OpenLayers dateline setting. You should add an issue of that to the google code host page about that. It should be pretty straightforward to implement once it is on the “roadmap”.

See the raw example (of what should be implemented) here:
http://openlayers.org/dev/examples/wrapDateLine.html

cheers,
matti

I welcome you again, Matti Tahvonen!

Thank you very much for your reply!:smiley:
Maybe you know how to solve the problem described
here
?