AnsweredAssumed Answered

Reprojected Geometry services not getting the desired fillSymbol/SimpleMarkerSymbol styles.

Question asked by zapkingdude on Aug 18, 2016
Latest reply on Aug 18, 2016 by fcbassongis

I have the map services created from the datasets with WGS84 / UTM Zone 37N (wkid: 32637) projection and I am converting the projection to WGS 84 (wkid : 4326) using the OSgeo's Proj4.js file for the services to load the features in desired location on the base maps provided by ArcGIS. 

 

All the layers are loading fine but, the fillSymbol or the desired SimpleMarkerSymbol styles given to the output geometry are not getting applied to them.

 

var fieldsSelectionSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
        new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]), 2), new Color([255, 255, 0, 0.25]));
        qryTsk = new QueryTask(featurelayerur3);
        qry = new Query();
        qry.where = queryString;
        qry.returnGeometry = true;
        qryTsk.execute(qry, getUpdateDelteResults);
        function getUpdateDeleteResults(results) {
            var k = 0;
            var splcount = 0;
            if (results.features.length > 0) {
               var extent = esri.graphicsExtent(results.features);
               var proj1 = "+proj=utm +zone=37 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
               var proj2 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
               var reprojectedCoords1 = proj4(proj1, proj2, [extent.xmin, extent.ymin]);
               var reprojectedCoords2 = proj4(proj1, proj2, [extent.xmax, extent.ymax]);
               var newextente = new esri.geometry.Extent(reprojectedCoords1[0], reprojectedCoords1[1], reprojectedCoords2[0], reprojectedCoords2[1],
                   new esri.SpatialReference({ wkid: 4326 }));
               map.setExtent(newextente);
               var queryPoint_symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 15,
               new SimpleLineSymbol(SimpleLineSymbol,
                   new Color([238, 27, 34]), 2), new Color([238, 27, 34, 1]));
               $.each(results.features, function () {
                  var outline_geometry = results.features[k].geometry;
                  qtpointsQ = new QueryTask(refFeaturelayerUrl);
                  utpoint = new Query();
                  utpoint.geometry = outline_geometry;
                  utpoint.returnGeometry = true;
                  utpoint.outFields = ["*"];                                            
                  if (spatialMethod == "intersect")
                      utpoint.spatialRelationship = utpoint.SPATIAL_REL_INTERSECTS;
                  else if (spatialMethod == "overlaps")
                      utpoint.spatialRelationship = utpoint.SPATIAL_REL_OVERLAPS;
                  else if (spatialMethod == "within")
                      utpoint.spatialRelationship = utpoint.SPATIAL_REL_WITHIN;                                            
                  qtpointsQ.execute(utpoint, saptialresults);
                       function saptialresults(results) {
                           if (results.features.length > 0) {
                              for (var i = 0; i < results.features.length; i++) {
                                  var resGraphic = results.features[i];
                                  resGraphic.setSymbol(queryPoint_symbol);
                                  map.graphics.add(resGraphic);
                                  var extent = esri.graphicsExtent(results.features);
                                  var fname = "BuildingPolygon";
                                  window[fname].setOpacity(0.5);
                                  splcount++;
                                  document.getElementById("lblQuery").innerHTML = "Spatial Filter results:" + splcount                                                        
                              }
                           }
                       }
                   k++;
                });
             }
             else {
                 document.getElementById("lblQuery").innerHTML = "No Results were Returned..Pls Check the Query";
             }
        $('.processing').fadeOut(3000);
     };

In the above code snippet, it is to give out the spatial query results where if there are some points within polygon, I am highlighting those points by the new SimpleMarkerSymbol in line no: 21. but the reprojected features are getting loaded but the neither the SimpleMarkerSymbol nor the SimpleFillSymbol styles defined are getting applied on the selected layers.


Same problem in allover the project, wherever the SimpleMarkerSymbol or the SimpleFillSymbol are called on the reprojected geometries, these styles are not getting applied.

 

Please help me to get a solution for this, this is making me scratch my head for past few weeks

Outcomes