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
So the query task definitely returns features and they are only displayed with the default symbology? I checked both your symbol definitions and they seem to be correct. Can you try/test setting the symbol after the graphics have been loaded with something like map.graphics.graphics[1].setSymbol(queryPoint_symbol) ?
I kinda tried that option before but no luck, but the symbols are now loading in the entirely different location of the map. please see the image for details
Seems like the problem is only with the reprojection. Instead of using Proj4, why don't you try the Geometry Service projection utility? GeometryService | API Reference | ArcGIS API for JavaScript 3.17
You can also get the UTM projection WKID and WKT here: ArcGIS REST API
Parasanna,
in line 22 you use a new simpleLineSymbol constructor and you have:
new SimpleLineSymbol(SimpleLineSymbol,
When it probably should be:
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
I also spotted that, but when constructing the symbol object with Prasanna's version, it actually creates the style as "solid".
isn't the deafult value of the SimpleLineSymbol is "STYLE_SOLID"??
Prasanna,
I have never seen it used that way before (unconventional), but it seems that the constructor is OK with that.