[OpenLayers-Users] The edges of my map get cut off

arvinporthog at lycos.com arvinporthog at lycos.com
Wed Sep 5 12:53:19 PDT 2012


Thanks you so much for looking at this Tondo. I managed to get it working much better. The problem was I had miscalculated the source image pixel sizes (forgot to turn centimeters to inches). Since I plugged the correct values into Bounds() I can now see the edges of the images at maximum resolution.

Early on I found I had to define Bounds() in order for openlayers to work right. Without defining bounds the map would open up teeny tiny and squeezed up into the upper left corner of the bounding <div>. The problem was I had no idea what Bounds() even is. The documentation doesn't really define it anywhere that I can see. Through trial and error I found I could plug in the image source pixel dimensions and things seemed to work right. But most of the time the Bounds() I see in examples don't look like pixel dimension at all. The Bounds() I supply look like new OpenLayers.Bounds(0,-8848,10927,0) but when I look at other peoples' they look like new OpenLayers.Bounds(189775.379950,4816289.746171,761662.354535,5472414.143295). What on the heck are with those decimal places? Why can I put zeroes for the first and last element?

I think I need most of the javascript in the maps.js file. The map owner asked me to support the standard options Geoserver puts out by default (yes, I started by copying Geoserver's default javascript just as you guessed, then factored out the map-specific stuff). Those are the options you see when you click the options icon above the zoom scale thing. But I'm certain you are right that there is a lot in there I don't need. If I only knew which parts those were.

Thanks for the link in your second email to all of those simple examples. I'm going to work on building up an interface starting from scratch using those examples. For some reason I have become the go-to guy for all of these map things and I have a lot more I have to do. But nobody suspects I don't have a clue what I'm doing. So I really have to start understanding this stuff.

Arvin


On Sep 4, 2012, Tondo <gpktondo at gmail.com> wrote: 

Hi

I think it's caused by map.maxExtent. If I am right, this should help you.
It requires little understanding what is bounding box... It's simple enough,
don't worry ;)

Let's say that you have a layer with your picture 100px X 100px. If you
place at 0, 0 upper left corner, bounds will be top: 0, left: 0, right: 100,
bottom: 100. If you place at 0, 0 center, bounds might be +/- 50 and so
on...

This is your invisible wall... Map uses some extent - bounds, that if not
provided, it's calculated. It will not allow you to pan outside this wall -
it's called bounding box. Open your JS debug tool and tap map.getExtent()
and map.maxExtent.

See this:
http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.maxExtent



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/The-edges-of-my-map-get-cut-off-tp4999122p4999764.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list