Select to view content in your preferred language

What are the units of the M value from MapPoint?

1570
8
Jump to solution
10-16-2019 12:30 PM
ITS_JohnColaneri
Emerging Contributor

I am using Esri libraries in a Xamarin Android (C#) project. I'm pulling a list of MapPoints from a PolyLine and examining the M value. As the number is increasing while I traverse the list, I assume it is a cumulative total distance measure of some sort from the origin point. No matter what kind of tweaking and torking I do though, I can't make this value look like the total distance, or even get to the same order of magnitude. I've tried degrees -> km, and various other attempts at conversion. (I'm in WGS84 spatial reference).

0 Kudos
1 Solution

Accepted Solutions
JoeHershman
MVP Regular Contributor

I don't do much routing, but my understanding is the M corresponds to a weight of that route.  So a two lane hwy would have a higher weight than an interstate, and that is used to compute the best route.  Shortest not always being the best

Thanks,
-Joe

View solution in original post

0 Kudos
8 Replies
JoeHershman
MVP Regular Contributor

M is a relative measure of length and can represent any unit of measure.  It could be length in feet, or it could be the time it takes a turtle to walk from one point to the next.  It is what the creator of the data meant it to mean.

Thanks,
-Joe
0 Kudos
ITS_JohnColaneri
Emerging Contributor

Interesting. This is consistent with something I saw elsewhere as I was researching the problem. So the question becomes: If I perform a route solve, and look at the DirectionManeuvers, I got these numbers from Esri. How do I then covert the "arbitrary" units to miles, or meters? Will they be consistent sized units across different routes or executions of the app?

foreach(var i in firstRoute.DirectionManeuvers)
{
   Console.WriteLine("\n\n>> Spacial Reference >>" + i.Geometry.SpatialReference + "\n\n");
   Console.WriteLine(i.Geometry.ToJson());
   if(i.Geometry.GeometryType == GeometryType.Polyline) {
      foreach(var j in ((Polyline)i.Geometry).Parts)
      {
         foreach(var k in j.Points)
         {
            Console.WriteLine(k.M);
         }
      }
   }
}

0 Kudos
dotMorten_esri
Esri Notable Contributor

If it's from routing, it depends on how the routing was configured. See the outputLines section here for a few suggestions of what it might be:

https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm#ESRI_SECTION3... 

0 Kudos
JoeHershman
MVP Regular Contributor

I don't do much routing, but my understanding is the M corresponds to a weight of that route.  So a two lane hwy would have a higher weight than an interstate, and that is used to compute the best route.  Shortest not always being the best

Thanks,
-Joe
0 Kudos
ITS_JohnColaneri
Emerging Contributor

Ok, Thanks. It looks like, from the link you sent, you can set it to be different things. Let me chew on this for a while...

0 Kudos
ITS_JohnColaneri
Emerging Contributor

So, unfortunately, as is the case with many of these APIs, there isn't really a 1 to 1 correspondence between the settings in the rest article listed above, and the C# Xamarin Android API. Indeed, there doesn't seem to be a consistent correlation between the DirectionManeuver.Length, and the sum of it's parts' M values. Will call Joe the winner on this one. Thanks.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

John,

Joe is correct: the M values are in the units of the impedance. For example, using Streetmap Premium California and using 2 stops at -13048589, 4036266 & -13049065, 4036270 with the default travel mode of "Driving Time" the impedance is in Minutes. The output route geometry polyline (ToJson) provides:

`[-13048589.117193095, 4036266.1880055116, 0]` => Start therefore 0 minutes
`[-13048820.616989916, 4036267.50599994, 0.32905645174046566]` => 0.33 min or approx 19 sec

ArcGIS Network Dataset Travel Mode dialog

Regards

Mike

0 Kudos
ITS_JohnColaneri
Emerging Contributor

Ok, Thanks for the details.

0 Kudos