-1

I have a data set with many maritime routes that I would like to see the m values (time) for. ArcGIS's Identify Route Locations tool works exactly as I want it to, however, the m value displayed is in Unix time which is not easily read, if at all. I need to convert the Unix times to something readable. I found that using datetime.datetime.fromtimestamp().isoformat() works great but I don't want the user to have to convert the time by hand every time they click along the line. Is there a way to create a tool that works like Identify Route Locations but also converts the m values before displaying them? I can't figure out how to access them. I've looked around and the only solutions I've found were to break down the routs back into points and recalculate the m values, but I'd rather avoid that.

1

Not sure the tool you are talking about is easy thing to do. What stops you of changing shapes themself using basic field calculator expression? You can run in on geometry (Shape) field, e.g. Modifying vertices x,y values to remove all value from 3rd decimal in ArcMap?

UPDATED ANSWER:

In environment settings make M enabled. Run this expression on Shape field:

def plineM(shp):
 arr=arcpy.Array();pM=arcpy.Point()
 part=shp.getPart(0);n=len(part)
 for i in xrange(n):
  p=part.getObject(i)
  pM.X=p.X;pM.Y=p.Y;pM.Z=p.Z
  pM.M=7627.462-p.M #your transformation here
  arr.add(pM)
 return arcpy.Polyline(arr)

Using:

plineM( !Shape! )
  • According to that link, I can use that information to manipulate the x, y, and z geometries but it says nothing about m. – Tiffany Aug 17 '15 at 14:12
  • See if updated answer makes sense – FelixIP Aug 17 '15 at 21:41
  • When creating the pM.M value, what exactly is that line of code doing? Where does the number 7627.462 come from and why am I subtracting p.M from it? Do I need to add anything to that line? Running the code as is, I get the dreaded error 999999. – Tiffany Aug 19 '15 at 14:54
  • Change this line – FelixIP Aug 19 '15 at 18:31
  • Forget about my suggestion. I thought you are talking only numeric transformation, but you want to display string representation of converted value using .isoformat() – FelixIP Aug 19 '15 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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