Skip to content

Commit 9f905c4

Browse files
Merge pull request #22 from GinoMellino/develop
Add support for mosaic datasets on Pro
2 parents f1c005c + 2202b00 commit 9f905c4

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

arcpyext/mapping/_cim/factories.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
import json
1313

14-
from .layers import ProFeatureLayer, ProGroupLayer, ProRasterLayer
14+
from .layers import ProFeatureLayer, ProGroupLayer, ProRasterLayer, \
15+
ProMosaicLayer, ProFeatureMosaicSubLayer, ProImageMosaicSubLayer
1516

1617

1718
def create_layer(proj_zip, layer_string):
@@ -30,6 +31,12 @@ def create_layer(proj_zip, layer_string):
3031
layer_obj = ProGroupLayer(proj_zip, layer_string)
3132
elif layer_type == "CIMRasterLayer":
3233
layer_obj = ProRasterLayer(proj_zip, layer_string)
34+
elif layer_type == "CIMMosaicLayer":
35+
layer_obj = ProMosaicLayer(proj_zip, layer_string)
36+
elif layer_type == "CIMFeatureMosaicSubLayer":
37+
layer_obj = ProFeatureMosaicSubLayer(proj_zip, layer_string)
38+
elif layer_type == "CIMImageMosaicSubLayer":
39+
layer_obj = ProImageMosaicSubLayer(proj_zip, layer_string)
3340
else:
3441
# layer is probably XML, fallback to that
3542
if layer_string.startswith("<CIMFeatureLayer"):
@@ -38,5 +45,11 @@ def create_layer(proj_zip, layer_string):
3845
layer_obj = ProGroupLayer(proj_zip, layer_string)
3946
elif layer_string.startswith("<CIMRasterLayer"):
4047
layer_obj = ProRasterLayer(proj_zip, layer_string)
48+
elif layer_string.startswith("<CIMMosaicLayer"):
49+
layer_obj = ProMosaicLayer(proj_zip, layer_string)
50+
elif layer_string.startswith("<CIMFeatureMosaicSubLayer"):
51+
layer_obj = ProFeatureMosaicSubLayer(proj_zip, layer_string)
52+
elif layer_string.startswith("<CIMImageMosaicSubLayer"):
53+
layer_obj = ProImageMosaicSubLayer(proj_zip, layer_string)
4154

4255
return layer_obj

arcpyext/mapping/_cim/layers.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from .tables import ProFeatureTable
2020

2121
# .NET Imports
22-
from ArcGIS.Core.CIM import CIMFeatureLayer, CIMGroupLayer, CIMRasterLayer
22+
from ArcGIS.Core.CIM import CIMFeatureLayer, CIMGroupLayer, CIMRasterLayer, \
23+
CIMMosaicLayer, CIMImageMosaicSubLayer,CIMFeatureMosaicSubLayer
2324

2425

2526
class ProLayerBase(with_metaclass(ABCMeta, object)):
@@ -110,3 +111,33 @@ def __init__(self, proj_zip, layer_string):
110111

111112
def _get_child_paths(self):
112113
return [cp[8:] for cp in self._cim_obj.Layers]
114+
115+
116+
class ProMosaicLayer(ProLayerBase):
117+
def __init__(self, proj_zip, layer_string):
118+
try:
119+
super().__init__(proj_zip, CIMMosaicLayer.FromXml(layer_string))
120+
except AttributeError:
121+
# probably JSON, attempt that
122+
super().__init__(proj_zip, CIMMosaicLayer.FromJson(layer_string))
123+
124+
def _get_child_paths(self):
125+
return [self._cim_obj.BoundaryLayer[8:], self._cim_obj.FootprintLayer[8:], self._cim_obj.ImageLayer[8:]]
126+
127+
128+
class ProFeatureMosaicSubLayer(ProLayerBase):
129+
def __init__(self, proj_zip, layer_string):
130+
try:
131+
super().__init__(proj_zip, CIMFeatureMosaicSubLayer.FromXml(layer_string))
132+
except AttributeError:
133+
# probably JSON, attempt that
134+
super().__init__(proj_zip, CIMFeatureMosaicSubLayer.FromJson(layer_string))
135+
136+
137+
class ProImageMosaicSubLayer(ProLayerBase):
138+
def __init__(self, proj_zip, layer_string):
139+
try:
140+
super().__init__(proj_zip, CIMImageMosaicSubLayer.FromXml(layer_string))
141+
except AttributeError:
142+
# probably JSON, attempt that
143+
super().__init__(proj_zip, CIMImageMosaicSubLayer.FromJson(layer_string))

0 commit comments

Comments
 (0)