[OpenLayers-Users] Distance problem
Steve.Toutant at inspq.qc.ca
Steve.Toutant at inspq.qc.ca
Thu Nov 26 09:15:43 EST 2009
Hi,
Yes you can get the correct length setting the geodesic properties of the
measure control to true.
But this measure won't fit with the scaleline.
I might be wrong but I think there is no such geodesic property for the
scaleline.
Steve
"Arnd Wippermann" <arnd.wippermann at web.de>@openlayers.org
Envoyé par : users-bounces at openlayers.org
25/11/2009 05:47 PM
A
"'Nicolas Noe'" <niconoe at ulb.ac.be>
cc
users at openlayers.org
Objet
Re: [OpenLayers-Users] Distance problem
Hi,
Also the map units are in meters, doesn't mean that you can measure real
length. EPSG:900913 is not a length-preserving projection. As you can see
that the equator have the same lenght as the north or south pole! With the
OpenLayers measure control you can get probably the correct length.
Arnd
-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Nicolas Noe
Gesendet: Mittwoch, 25. November 2009 12:01
An: users at openlayers.org
Betreff: [OpenLayers-Users] Distance problem
Hi everyone,
I have a simple problem, bit I can't figure it. I'm probably missing
something very simple and stupid !
I have an OL map with google background. The projection is EPSG:900913, so
the map unit is meters (right?).
I have a marker layer, on which I add a first marker. Then I ask OL to
compute a second marker 1 kilometer on the east, and display it.
It seems to work, except of my distance problem : if I check with the OL
scaleline, there's 1 KM between both markers (which is correct).
However, if I use the ruler tool of Google Earth, I can see there is only
about 650 meters between these 2 points.
Do you have any idea of where my error is ?
Thanks in advance,
Here is my code :
var BeBounds = new OpenLayers.Bounds(2.5, 49.5, 6.5, 51.5);
function mapInit() {
var map = new OpenLayers.Map('map', {
projection: new OpenLayers.Projection("EPSG:900913"),
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new
OpenLayers.Control.LayerSwitcher({'ascending':false}),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.Permalink('permalink'),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.KeyboardDefaults()
]
});
var gsat = new OpenLayers.Layer.Google("Google Hybrid",
{
type: G_HYBRID_MAP,
'sphericalMercator':true,
maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
/*, numZoomLevels: 20*/ });
var markers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(gsat);
map.addLayer(markers);
// Add a marker
var myPoint = new OpenLayers.LonLat(5.080646954,50.49373471);
var myPointInMeters = myPoint.transform(new
OpenLayers.Projection("EPSG:4326"), map.projection);
var pt2 = myPointInMeters.add(1000,0);
var mymark = new OpenLayers.Marker(myPointInMeters);
var mymark2 = new OpenLayers.Marker(pt2);
markers.addMarker(mymark);
markers.addMarker(mymark2);
map.zoomToExtent(BeBounds.transform(new
OpenLayers.Projection("EPSG:4326"), map.projection)); }
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091126/e748252d/attachment.html
More information about the Users
mailing list