Select to view content in your preferred language

SetMDomain not working

882
2
01-02-2012 06:17 PM
RogerLoweth
Emerging Contributor
Anyone know why this doesn't work:


sr = arcpy.Describe(my_bathy).spatialReference
sr.setMDomain(-100000, 100000)

ZM are both enabled for my_bathy.

Thanks, Roger
Tags (2)
0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor
Roger,

I just tried the following code on a river network I have and it did not produce an error.

# Layer name in Map Document
s = "Rivers"

# Describe object and print name string to confirm it worked
desc = arcpy.Describe(s)
print desc.namestring

# Get spatial reference and print name
sr = desc.spatialreference
print sr.name

# Get FeatureClass and check if M aware
fc = desc.featureclass
print fc.hasm

# Set M domain
sr.setmdomain( -1000,1000)


This would suggest that there is something odd with your layer as your code looks sound?

Duncan
0 Kudos
RogerLoweth
Emerging Contributor
Thanks Duncan,

Finger trouble with upper/lower case - misdirection from ESRI helpfile.

Cheers, Roger

Roger,

I just tried the following code on a river network I have and it did not produce an error.

# Layer name in Map Document
s = "Rivers"

# Describe object and print name string to confirm it worked
desc = arcpy.Describe(s)
print desc.namestring

# Get spatial reference and print name
sr = desc.spatialreference
print sr.name

# Get FeatureClass and check if M aware
fc = desc.featureclass
print fc.hasm

# Set M domain
sr.setmdomain( -1000,1000)


This would suggest that there is something odd with your layer as your code looks sound?

Duncan
0 Kudos