[OpenLayers-Users] scaleline in lon/lat projection
Jan Burdziej
jab at umk.pl
Thu Apr 29 04:21:27 EDT 2010
Hi,
I have created a ticket at: http://trac.openlayers.org/ticket/2600. I hope I
did it correctly, as it was my first ticket :)
However, I still have a problem with ScaleLine on WGS84-based map. Below I
attach a complete html file with a map. In this example when I zoom in to
Europe and pan from N to S the ScaleLine does not change. Unless I move to
the pole, but this was discussed earlier and a ticket for this has been
created.
My questions are also:
1. What do you think about updating OpenLayers.INCHES_PER_UNIT instead of
calculating N-S or W-E geodesic distances for calibrating the scale line
control.
2. If you apply a patch that changes the scale line control to do a
West-East measurement instead what will happen if you drag your map beyond
-180/180 longitudes?
3. Do you have any idea whether MapFish will also adopt geodesic scale bar
functionality?
Regards,
Jan
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ScaleBar Problem</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map, scalebar;
function init(){
map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}
);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 2);
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.ScaleLine({geodesic:
true}))
}
</script>
</head>
<body onload="init()">
<div style="width:600; height:400" id="map"></div>
</body>
</html>
Jan Burdziej
2010/4/28 Andreas Hocevar <ahocevar at opengeo.org>
>
> On Apr 28, 2010, at 16:46 , Jan wrote:
>
> > Strange. Now it works, but only with OSM layer (which is in Spherical
> Mercator) and it does not work when I use WGS-based layer (e.g. "
> http://labs.metacarta.com/wms/vmap0") - in this case scaleline changes
> between 1000 and 10000 km when I drag a map towards poles.
>
> The ScaleLine control uses a line in North-South direction to calculate the
> scale distance. If you are at the poles, there will be one coordinate that
> goes beyond the pole. Hence the measurement problem. Can you please create a
> ticket, I have a patch that changes the scale line control to do a West-East
> measurement instead.
>
> Regards,
> Andreas.
>
> >
> > Regards,
> > Jan Burdziej
> >
> >
> > 2010/4/28 Bart van den Eijnden <bartvde at osgis.nl>
> > Add your control after the call to zoomToMaxExtent.
> >
> > Best regards,
> > Bart
> >
> > On Apr 28, 2010, at 2:34 PM, Jan wrote:
> >
> >> var map, scalebar;
> >>
> >> function init(){
> >>
> >> map = new OpenLayers.Map('map');
> >> var layer = new OpenLayers.Layer.WMS(
> >>
> >> "OpenLayers WMS",
> >>
> >> "http://labs.metacarta.com/wms/vmap0",
> >> {layers: 'basic'}
> >>
> >> );
> >>
> >>
> >> map.addLayer(layer);
> >>
> >>
> >> var scalebar = new OpenLayers.Control.ScaleLine({
> >> geodesic: true
> >> });
> >>
> >> map.addControl(scalebar);
> >>
> >> map.zoomToMaxExtent();
> >>
> >>
> >> }
> >>
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100429/5603e590/attachment.html
More information about the Users
mailing list