4

My map projection is: "EPSG:900913", display projection is "EPSG:4326" and units is "m", however does not equal the length in Direction/length with the length is calculated in measuring in OpenLayers, in fact OpenLayers show the length more than the actual length when I use measure control. I've set the option geodesic: true to my measure control.

For example:

the enter length is: 100m

direction/length

the length after measuring is: 85.29m

length of line

Define measure control:

 measureLine = new OpenLayers.Control.DynamicMeasure(OpenLayers.Handler.Path);
measureLine.geodesic = true;

function insertDirectionLength(drawType) {
    var values = parseInput(
    window.prompt(
            "Enter direction and length offset values for new point (e.g. '-45, 10')", "direction, length"
    )
     );
     if (values != null) {
         var controlKey,key;
         for (key in controls) {
             controlKey = controls[key];
             if (drawType == key) {
                  controlKey.insertDirectionLength(values[0], values[1]);
             } 
         }
     }
 }

How to resolve this problem?

marked as duplicate by nmtoken, aldo_tapia, BERA, whyzar, MaryBeth Dec 15 '17 at 14:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    You're using Mercator for length and comparing with great circle on a sphere? – Vince Oct 25 '15 at 22:31
  • Similar to gis.stackexchange.com/questions/48142/… (which is itself a duplicate) – Vince Oct 25 '15 at 22:32
  • @Vince No, My question is different!!! – Samane Oct 27 '15 at 5:48
  • 2
    Let me guess--the line is around latitude +/-31.5 degrees? – mkennedy Jan 6 '16 at 19:56
  • 1
    Every time someone says EPSG:900913 it makes @mkennedy eyes twitch. Please use code EPSG:3857 instead. – Mintx Jan 8 '16 at 14:46
0

My map projection is: "EPSG:900913" ,Display projection is "EPSG:4326"

I believe this is the crux of your problem. It looks like you are drawing in EPSG:900913 EPSG:3857 and you are measuring in EPSG:4326.

The Pseudo-Mercator projection is notoriously bad at calculating/drawing distances, so I would not use this projection for that kind of work.

Not the answer you're looking for? Browse other questions tagged or ask your own question.