I have a shapefile containing polygons and whenever a user searches an address I store latitude and longitude of the location. I want to know which polygon this address belongs and I have id assigned for each polygon in the shapefile. But I am new to ArcGIS API I couldn't figure it out. I tried this:

var queryCitiesTask = new QueryTask({
    url: "https://****/gridpointspolygon/MapServer/1"  
var query = new Query();
query.geometry = new Point(long, lat); // 
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS; 
query.outFields = ["pt_v03_ind"];
query.returnGeometry = false;
queryCitiesTask.execute(query, function (result) {
  • Are your "shapefile" polygons in the "gridpointspolygon/MapServer/1"? Is that layer also on the map? – Bjorn Svensson Mar 30 '18 at 22:51
  • Polygons are there but not on map – CS Help Mar 31 '18 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.