WebGIS Discussions

Need a push in the right direction when configuring WebMap, Portal or SDI services? Looking for hints and tips, or just looking for Ideas and information? The WebGIS discussion board is where you start those discussions, connect and share information.
Showing results for 
Search instead for 
Do you mean 
Reply
Staff
Posts: 99
Registered: ‎02-10-2017

PSS Get all features from a FC

Hi.

 

I'm trying to get all features from a specific FC in a PSS service but the result is always the same: none of the features that exists are returned. It always return empty [].

 

 

$GP.edit.features.find({featureClassId: "FeatureClass1", mapStateId: 'map', featureIds: [], mapServiceId: 'a6d1-afdd-ac9a-e359'}, function(result){console.log(result.features);}, function(){console.log('Error executing action!');})

 

Also if I try to obtain it without $GP the result is the same:

 

$mapServiceManager.findMapService(mapServiceId)._featureDataset._featureClasses[pssId]._features

Any hint about this issues?

 

TIA

António

 

Technical Evangelist
Posts: 1,424
Registered: ‎09-11-2015

Re: PSS Get all features from a FC

[ Edited ]

Hi Antonio,

 

First of all, $GP.edit.features.find() is not used for getting all features. It is used for getting a certain feature by some ID. If you want to get all the features, you should rather use e.g. exportFeatureCollections. This code works fine for me:

 

$GP.services.find({
   definitionName: "PersonalStorage",
   name: "PSS1"
}, function (result1) {
   $GP.edit.getFeatureClassIds({
      mapServiceId: result1.mapServiceId
   }, function (result2) {
      var fIds = result2.featureClassIds;
      //console.log("Feature Class Ids:");
      //console.log(fIds);

      $GP.edit.features.exportFeatureCollections({
         mapServiceId: result1.mapServiceId,
         featureClassIds: fIds
      }, function (res) {
         console.log("Features Returned:");
         console.log(res);
      }, function (err) {
         console.log(err);
      });
   }, function (err2) {
      console.log(err2);
   });
}, function (err3) {
   console.log(err3);
});

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial