AnsweredAssumed Answered

How to add feature layer to map (basemap as mmpk and tif formats) using .shp file?

Question asked by abhijeet.satam on Oct 6, 2020
Latest reply on Oct 6, 2020 by LDanzinger-esristaff

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::ArcGISRuntime::LayerListModel* llModel;
Esri::ArcGISRuntime::FeatureLayer* layerA;
llModel = m_map->operationalLayers();
FeatureTable* featuretable_layerA = new ShapefileFeatureTable(pathToShpFile,this);
layerA = new FeatureLayer(featuretable_layerA,this);
connect(layerA, &FeatureLayer::doneLoading,this, [this,layerA](Error loadError)
    {
        if(!loadError.isEmpty())
            return;
        m_mapView->setViewpointCenter(layerA->fullExtent().center(),80000);

        qDebug("LAYERA CONNECTED");
    });


SimpleLineSymbol* simpleLine = new SimpleLineSymbol(SimpleLineSymbolStyle::Solid,
                                                    QColor("red"), 3.0,layerA);
SimpleRenderer* simpleRenderer = new SimpleRenderer(simpleLine, this);
layerA->setRenderer(simpleRenderer);
llModel->append(layerA);

 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??.

Outcomes