Select to view content in your preferred language

How can I add fields and data in a dynamic map services or Featurelayers?

1023
0
10-06-2016 03:45 AM
ParkSeungHyun
Deactivated User

i`m trying to statistics data rendering. 

Statistical data is not the mapservice data.  It is a specific statistical data that the user enters.

So I try to add the data to featurelayers.

However, because the request is rendered disappeared again whenever you pan the map.

So the graphics layer was trying to save the featureset.

However, the query speed is too slow.

An attempt has been made to render the dynamic layer.

But I do not know how to add custom data to a dynamic layer.

How can I add fields and data in a dynamic map services or Featurelayers?

help me. I'm a beginner developer ongoing projects alone.

my featurelayer rocords is 17, 300, 6000.

test 1 : 

getListLawBoundary : function(map){
var LawBoundary = {
SIDO : [],
SGG : [],
UMD : []
};

require(["esri/layers/FeatureLayer", "esri/tasks/query"
], function(FeatureLayer, Query) {
var SIDO = new FeatureLayer(map.Layers.getLayerInfo("STATISTICS").SVC_URL+'/0', {id : "SIDO",mode: FeatureLayer.MODE_AUTO});
var SGG = new FeatureLayer(map.Layers.getLayerInfo("STATISTICS").SVC_URL+'/1', {id : "SGG",mode: FeatureLayer.MODE_AUTO});
var UMD = new FeatureLayer(map.Layers.getLayerInfo("STATISTICS").SVC_URL+'/2', {id : "UMD", mode: FeatureLayer.MODE_AUTO});
map.getMap().addLayers([SIDO,SGG,UMD]);
map.addEvent('layer-add',function(e){
var query = new Query();
query.where = "1=1";
query.outFields = ["*"];
query.returnGeometry = true;
query.outSpatialReference = map.getMap().spatialReference;
e.layer.queryFeatures(query, function (featureSet) {
var resultObject = null;
_ggg = map.getGraphicLayer('select');
if(e.layer.id == "SIDO"){
for(var i = 0, length = featureSet.features.length; i < length; i++){
resultObject = featureSet.features;
LawBoundary.SIDO = resultObject;
_ggg.add(resultObject);
}
}
else if(e.layer.id == "SGG"){
for(var i = 0, length = featureSet.features.length; i < length; i++){
resultObject = featureSet.features;
LawBoundary.SGG = resultObject;
_ggg.add(resultObject);
}
}
else if(e.layer.id == "UMD"){
for(var i = 0, length = featureSet.features.length; i < length; i++){
resultObject = featureSet.features;
LawBoundary.UMD = resultObject;
_ggg.add(resultObject);
}
}
});
map.getMap().removeLayer(e.layer);

});
});
return LawBoundary;
}

test 2 : 

queryTask : function (map){
var LawBoundary = {
SIDO : [],
SGG : [],
UMD : []
};

require(["esri/layers/FeatureLayer", "esri/tasks/query", "esri/tasks/QueryTask"
], function(FeatureLayer, Query, QueryTask) {
var SIDO = new QueryTask(map.Layers.getLayerInfo("STATISTICS").SVC_URL+'/0');
var SGG = new QueryTask(map.Layers.getLayerInfo("STATISTICS").SVC_URL+'/1');
var UMD = new QueryTask(map.Layers.getLayerInfo("STATISTICS").SVC_URL+'/2');
var query = new Query();
query.where = "1=1";
query.outFields = ["*"];
query.returnGeometry = true;
query.outSpatialReference = map.getMap().spatialReference;
SIDO.execute(query, function (featureSet) {
for(var i = 0, length = featureSet.features.length; i < length; i++){
LawBoundary.SIDO = featureSet.features;
}
});
SGG.execute(query, function (featureSet) {
for(var i = 0, length = featureSet.features.length; i < length; i++){
LawBoundary.SGG = featureSet.features;
}
});
UMD.execute(query, function (featureSet) {
for(var i = 0, length = featureSet.features.length; i < length; i++){
LawBoundary.UMD = featureSet.features;
}
});
});

return LawBoundary;
}

0 Kudos
0 Replies