0

I have a web application based on ArcGIS API for Javascript 3. In the web application a QueryTask is executed on a MapServer feature layer. The result feature set is used to create a Feature Layer and displayed on the map. Here is a piece of the Javascript source code.

getFeatures: function(layer) {
 let query = new Query();
 query.returnGeometry = true;
 query.outSpatialReference = this.map.spatialReference;
 query.where = this.createWhereQuery();
 query.outFields = ["*"];
 layer.queryTask.execute(query, lang.hitch(this, function (featureSet) {
 if (featureSet.features.length > 0) {
 console.log(featureSet.features);
 let geomType = "esriGeometryPoint";
 let layerDefinition = {
 "geometryType": geomType,
 "fields": [{ name: "OBJECTID", type: "esriFieldTypeOID", alias: "OBJECTID" }]
 }
 let featureCollection = {
 layerDefinition: layerDefinition,
 featureSet: featureSet
 };
 let clusterLayer = new FeatureLayer(featureCollection, {
 outFields: ["*"],
 featureReduction: {
 type: "cluster"
 }
 });
 this.map.addLayer(clusterLayer);
 }),
 lang.hitch(this, function (error) {
 console.log(error);
 alert("Unable to load points data. Contact server administrator.");
 }));
}

Everything worked as excepted when MapServer used data from ESRI File Geodatabase. Recently we created a Postgresql database and published an identical copy of MapServer where data comes from the Postgresql database.

After replacing new MapServer URLs in the web application, I noticed that only single feature is displayed on the map after executing above QueryTask. Nothing, except the URLs, was changed in the Javascript code.

When printing in browser console featureSet.features, I noted that the first feature object looks different than the rest (console print screen below). Private properties are present in the first feature object, and not present in the rest feature objects. I guess this is the reason why only a single feature (the first one) is displayed on the map.

console-print-screen

When printing in browser console the same featureSet.features using Mapserver with data from ESRI File Geodatabase, then all feature object look similar to the first one described above, and all features are displayed on the map.

Where is the problem and how to fix it?

asked Feb 26 at 14:12
2

1 Answer 1

0
answered Feb 28 at 8:08
2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Feb 28 at 8:14
  • Please don't just give link to the answer, post answer itself. Links tend to get lost in time. Commented Feb 28 at 17:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.