Query Feature Layer / Create Layer from Shapefile

4227
14
04-12-2016 05:18 AM
DanielBachmann1
New Contributor

Hi,

I'm trying to use the runtime sdk to load a shapefile and dynamically change the geometry shown by querying the attribute table. I created an EsriRuntimeQt::LocalFeatureService for an "empty" mpk file and added the Shapefile using the approach from QtSampleApplication_10.2.6_win64 to a ArcGISDynamicMapServiceLayer. Then I created a local Feature service (pointing to the same mpk-file) and created a FeatureLayer in the slot called on layerCreateComplete().

But creating a FeatureLayer in this method like

m_featureLayer = new EsriRuntimeQt::ArcGISFeatureLayer(m_dynamicLocalServiceLayer->url()+"/0",this);

m_featureLayer->setOperationMode(EsriRuntimeQt::QueryMode::SelectionOnly);

m_map->addLayer(m_featureLayer);    connect(m_featureLayer, SIGNAL(layerCreateComplete()), this, SLOT(onFeatureLayerCreateComplete()));

connect(m_featureLayer, SIGNAL(layerCreateError(QString)), this, SLOT(onFeatureLayerCreateError(QString)));

fails. None of the slots above is called.

What am I missing?

Thanks,

Daniel

0 Kudos
14 Replies
LucasDanzinger
Esri Frequent Contributor

Just to follow up, with the local dynamic map service, you should be able to do definition expression. Here is how you would go about it:

- Create a local map service

- enable dynamic layers on it - ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::LocalMapService Class Reference

- Once the service is started and the layer is loaded, obtain the dynamic layer infos from the layer

- obtain the dynamic layer info for the associated layer you are working with

- set the definition expression on the applicable dynamic layer info - ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::LayerInfo Class Reference

- refresh the layer - ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::ArcGISDynamicMapServiceLayer Class Reference

This should work for you. Like I said, the workflow is a bit long right now, but we will soon have native support for shapefiles, and it should be very straightforward to do something like this.

-Luke 

0 Kudos
DanielBachmann1
New Contributor

Hi Luke,

works perfect. Thanks a lot! As long as the performance is acceptabe, the length of the workflow is no concern.

Do you know when native support for shapefiles will be available?

-Daniel

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Ok, great! We plan on releasing Quartz final around Q3 of this year. Shapefile support will not make it into that release, so it'll be in our first update, which we are planning for 3-4 months after, so end of this year/beginning of next.

0 Kudos
EricPflaum
New Contributor

Hi,

I'm new to the SDK.

At this point in time we have Qt SDK 10.2.6 and 100.0.0 available for download, and I'm not sure what Quartz refers to.

I need to import shapefiles using either the QML or C++ API, but I'm having difficulty finding documentation on how to do that.

What is the best method currently supported at this point?

Can you direct me to some examples?

Thanks,

-Eric

0 Kudos
LucasDanzinger
Esri Frequent Contributor

"Quartz" was the codename for our 100.0 release. This is the new generation of Runtime SDKs from Esri. The 100.0 release does not yet have support for shapefiles. However, our 10.2.6 release does have a way you can view shapefiles - ArcGIS for Developers | ArcGIS for Developers 

In an upcoming update of Runtime 100, we will have native support for shapefiles and it will be very easy to read and query them.

0 Kudos