Select to view content in your preferred language

Using jQuery for Intersects

2957
1
Jump to solution
08-27-2013 10:46 AM
AlexandreDinnouti
Deactivated User
I am trying to do a intersect between a Polygon and Points, the first step I get the polygon goAjaxCountry() and then with the results I try to get the points inside of the polygon goAjaxPoints(). However the points are not being filtered, I think the problem is with my rest parameters in  goAjaxPoints(). Do you have any advice?

 var url = 'someurl'; var country_response; var points_response;  function goAjaxCountry(){  restURL = url+'2/query';  restParm = {   where:"ISO3='MDG'",   f:'pjson'  };   $.post(restURL, restParm, function(data, textStatus) {   console.log('goAjaxCountry - ' + textStatus);   console.log(data);   $('#country_json').html('done');   country_response = data;   goAjaxPoints(data)  }, "json"); }  function goAjaxPoints(geo_country){   restURL = restURL = url+ '0/query';  restParm = {   where:"acq_date='2013-08-20'",   f:'pjson',   geometry: geo_country.features[0].geometry,   geometryType: geo_country.geometryType,     spatialRel: 'esriSpatialRelIntersects'  };    $.post(restURL, restParm, function(data, textStatus) {   console.log('goAjaxPoints - ' + textStatus);   console.log(data);   console.log(data.features.length)   points_response = data;  }, "json"); }



Thanks,
--Alex
0 Kudos
1 Solution

Accepted Solutions
AlexandreDinnouti
Deactivated User
I had to convert the json object to an string: geometry:
geometry: JSON.stringify(geo_countries.features[0].geometry)

View solution in original post

0 Kudos
1 Reply
AlexandreDinnouti
Deactivated User
I had to convert the json object to an string: geometry:
geometry: JSON.stringify(geo_countries.features[0].geometry)
0 Kudos