I have 2 map files one is of the .mmpk format and other is .tif format. I want to add a feature layer to my map using .shp file.
m_map is declared as Esri::ArcGISRuntime::Map* m_map = nullptr;
and m_mapView as Esri::ArcGISRuntime::MapGraphicsView* m_mapView = nullptr;
The code for feature layer is as follows:
Esri<SPAN class="operator token">::</SPAN>ArcGISRuntime<SPAN class="operator token">::</SPAN>LayerListModel<SPAN class="operator token">*</SPAN> llModel<SPAN class="punctuation token">;</SPAN>
Esri<SPAN class="operator token">::</SPAN>ArcGISRuntime<SPAN class="operator token">::</SPAN>FeatureLayer<SPAN class="operator token">*</SPAN> layerA<SPAN class="punctuation token">;</SPAN>
llModel <SPAN class="operator token">=</SPAN> m_map<SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN><SPAN class="token function">operationalLayers</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
FeatureTable<SPAN class="operator token">*</SPAN> featuretable_layerA <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token function">ShapefileFeatureTable</SPAN><SPAN class="punctuation token">(</SPAN>pathToShpFile<SPAN class="punctuation token">,</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
layerA <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token function">FeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN>featuretable_layerA<SPAN class="punctuation token">,</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="token function">connect</SPAN><SPAN class="punctuation token">(</SPAN>layerA<SPAN class="punctuation token">,</SPAN> <SPAN class="operator token">&</SPAN>FeatureLayer<SPAN class="operator token">::</SPAN>doneLoading<SPAN class="punctuation token">,</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">,</SPAN>layerA<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">(</SPAN>Error loadError<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>loadError<SPAN class="punctuation token">.</SPAN><SPAN class="token function">isEmpty</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN>
m_mapView<SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN><SPAN class="token function">setViewpointCenter</SPAN><SPAN class="punctuation token">(</SPAN>layerA<SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN><SPAN class="token function">fullExtent</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">center</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">80000</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="token function">qDebug</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"LAYERA CONNECTED"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
SimpleLineSymbol<SPAN class="operator token">*</SPAN> simpleLine <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token function">SimpleLineSymbol</SPAN><SPAN class="punctuation token">(</SPAN>SimpleLineSymbolStyle<SPAN class="operator token">::</SPAN>Solid<SPAN class="punctuation token">,</SPAN>
<SPAN class="token function">QColor</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"red"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">3.0</SPAN><SPAN class="punctuation token">,</SPAN>layerA<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
SimpleRenderer<SPAN class="operator token">*</SPAN> simpleRenderer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token function">SimpleRenderer</SPAN><SPAN class="punctuation token">(</SPAN>simpleLine<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
layerA<SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN><SPAN class="token function">setRenderer</SPAN><SPAN class="punctuation token">(</SPAN>simpleRenderer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
llModel<SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN><SPAN class="token function">append</SPAN><SPAN class="punctuation token">(</SPAN>layerA<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN> This code works when m_map uses the .tif file as the basemap but does not work for .mmpk format. Is .shp format only applicable to .tif basemaps?
Is any other format required to display feature layers in maps using mmpk file as basemap??.