Select to view content in your preferred language

How do you extract Line width and Scale from scale-based sizing (Unique Values)

440
1
05-16-2023 05:15 AM
AdrBrez
New Contributor

Hi, I'm trying to extract information about Scales and line width at these scales using Python (Notebooks). I tried to use CIM, but I hadn't accessed "scaleDependentSizeVariation" from lyr. I can see this information in JSON (.lyr) file, but I don't know how to extract this information.

  "scaleDependentSizeVariation" : [
{
"type" : "CIMScaleDependentSizeVariation",
"scale" : 1000000000,
"size" : 1.7291338582677165
},
{
"type" : "CIMScaleDependentSizeVariation",
"scale" : 120944,
"size" : 2
},
{
"type" : "CIMScaleDependentSizeVariation",
"scale" : 60472,
"size" : 2.5
},
{
"type" : "CIMScaleDependentSizeVariation",
"scale" : 30236,
"size" : 2.9763999999999999
},
{
"type" : "CIMScaleDependentSizeVariation",
"scale" : 25000,
"size" : 2.5
},
{
"type" : "CIMScaleDependentSizeVariation",
"scale" : 15118,
"size" : 3.5
}
]
},

AdrBrez_0-1684239198518.png

 

 

0 Kudos
1 Reply
by Anonymous User
Not applicable

Could you just read the .lyr file with JSON loads and then grab it from there, or do you have to go through other means?

variable = json.loads(r'path to .lyr')

for dct in variable['scaleDependentSizeVariation']:
    for k, v in dct.items():
        print(f'k: {k} v: {v}')
0 Kudos