What's the best way to filter "Select businesses" API calls using "spatialFilter"?

642
1
06-05-2017 12:02 PM
JedIsom
New Contributor

I have tried to follow the documentation on Select businesses—ArcGIS REST API: GeoEnrichment Service | ArcGIS for Developers  for creating a REST API call for businesses within a 3 mile area around a site, or other area.  The documentation on this page seems very vague and doesn't seem to match up with the common variable "studyAreas" found on other pages of the documentation like the Input XY Locations examples: Input XY locations—ArcGIS REST API: GeoEnrichment Service | ArcGIS for Developers.  Can someone please provide a clarifying example (or 2) of how I should make a call to find all businesses within a 3 mile ring around a specific latitude and longitude, while excluding businesses outside that 3 mile ring?

0 Kudos
1 Reply
DanielStauning
Esri Contributor

The recommended work flow would be to generate the ring buffer using the enrich method and then pass the buffer's geometry to the SelectBusinesses method. SelectBusinesses isn't capable of generating ring buffers at this time, it can accept accept IDs, ring geometries and map extents in the SpatialFilter parameter.

Here are some examples of this how works in the Business Analyst web application, please let us know if this helps. 

1. Generate 3 mile ring buffer using enrich:

http://geoenrich.arcgis.com/arcgis/rest/services/World/GeoEnrichmentServer/Geoenrichment/Enrich?stud... 

2. Call SelectBusinesses with the ring geometry, example usage for SpatialFilter parameter:

{"Boundaries":{"recordSet":{"spatialReference":{"wkid":102100,"latestWkid":3857},"geometryType":"esriGeometryPolygon","features":[{"geometry":{"rings":[[[-13046162.342933612,4042239.364255682],[-13045947.122462507,4042235.3661114466],[-13045732.19640765,4042223.3771564295],[-13045517.858780678,4042203.4138160753],[-13045304.402784584,4042175.50344092],[-13045092.120410804,4042139.6842687475],[-13044881.302038005,4042096.0053717387],[-13044672.236033123,4042044.526588642],[-13044465.208355235,4041985.318442045],[-13044260.502162753,4041918.4620409193],[-13044058.397424603,4041844.048968532],[-13043859.170535794,4041762.18115589],[-13043663.093938025,4041672.970740913],[-13043470.435745804,4041576.5399135537],[-13043281.459378606,4041473.0207470134],[-13043096.42319959,4041362.5550153977],[-13042915.580161368,4041245.2939979737],[-13042739.177459335,4041121.39827038],[-13042567.456193004,4040991.0374830374],[-13042400.651035866,4040854.3901271126],[-13042238.989914177,4040711.6432883553],[-13042082.69369514,4040562.9923891155],[-13041931.97588493,4040408.640918997],[-13041787.042336931,4040248.8001544354],[-13041648.090970634,4040083.688867654],[-13041515.311501509,4039913.53302541],[-13041388.885182329,4039738.565477884],[-13041268.984556172,4039559.02563827],[-13041155.773221534,4039375.1591534214],[-13041049.4056098,4039187.2175660348],[-13040950.026775433,4038995.457968872],[-13040857.772199107,4038800.1426515025],[-13040772.767604074,4038601.5387400175],[-13040695.12878601,4038399.9178302647],[-13040624.961456558,4038195.5556151094],[-13040562.361100757,4037988.73150621],[-13040507.412848566,4037779.7282508705],[-13040460.191360658,4037568.831544467],[-13040420.760728553,4037356.3296390288],[-13040389.174389336,4037142.51294846],[-13040365.475054957,4036927.6736510037],[-13040349.694656244,4036712.1052894387],[-13040341.8543017,4036496.1023696284],[-13040341.964251105,4036279.9599578865],[-13040350.023903951,4036063.9732777984],[-13040366.021802735,4035848.4373069927],[-13040389.935651042,4035633.646374418],[-13040421.732346447,4035419.8937587035],[-13040461.368028104,4035207.471288143],[-13040508.78813903,4034996.668942788],[-13040563.927502887,4034787.774459306],[-13040626.710415225,4034581.072939005],[-13040697.050749017,4034376.8464596486],[-13040774.852074338,4034175.3736915537],[-13040860.00779199,4033976.929518496],[-13040952.401280914,4033781.784663883],[-13041051.906059166,4033590.205322806],[-13041158.385958208,4033402.452800334],[-13041271.695310306,4033218.7831566245],[-13041391.679148734,4033039.446859303],[-13041518.173420519,4032864.6884435373],[-13041651.005211445,4032694.7461803243],[-13041789.992982978,4032529.851753351],[-13041934.946820807,4032370.2299449607],[-13042085.668694627,4032216.0983315133],[-13042241.95272886,4032067.666988666],[-13042403.585483877,4031925.138206881],[-13042570.346247397,4031788.706217559],[-13042742.007335633,4031658.556930182],[-13042918.334403763,4031534.867680778],[-13043099.086765349,4031417.806992062],[-13043284.01772025,4031307.5343455425],[-13043472.874890545,4031204.199965921],[-13043665.400564086,4031107.944618052],[-13043861.332045173,4031018.8994167396],[-13044060.40201187,4030937.185649583],[-13044262.338879537,4030862.9146131664],[-13044466.86717001,4030796.187462734],[-13044673.70788601,4030737.09507564],[-13044882.578890236,4030685.717928603],[-13045093.195288649,4030642.1259891177],[-13045305.269817421,4030606.3786209975],[-13045518.513233071,4030578.524504249],[-13045732.634705199,4030558.6015693983],[-13045947.342211379,4030546.6369462903],[-13046162.342933612,4030542.6469274913],[-13046377.343655845,4030546.6369462903],[-13046592.051162025,4030558.6015693983],[-13046806.172634153,4030578.524504249],[-13047019.416049803,4030606.3786209975],[-13047231.490578575,4030642.1259891177],[-13047442.106976988,4030685.717928603],[-13047650.977981213,4030737.09507564],[-13047857.818697214,4030796.187462734],[-13048062.346987685,4030862.9146131664],[-13048264.283855354,4030937.185649583],[-13048463.35382205,4031018.8994167396],[-13048659.285303138,4031107.944618052],[-13048851.810976679,4031204.199965921],[-13049040.668146973,4031307.5343455425],[-13049225.599101875,4031417.806992062],[-13049406.351463461,4031534.867680778],[-13049582.67853159,4031658.556930182],[-13049754.339619827,4031788.706217559],[-13049921.100383347,4031925.138206881],[-13050082.733138364,4032067.666988666],[-13050239.017172595,4032216.0983315133],[-13050389.739046417,4032370.2299449607],[-13050534.692884246,4032529.851753351],[-13050673.68065578,4032694.7461803243],[-13050806.512446705,4032864.6884435373],[-13050933.00671849,4033039.446859303],[-13051052.990556918,4033218.7831566245],[-13051166.299909016,4033402.452800334],[-13051272.779808057,4033590.205322806],[-13051372.28458631,4033781.784663883],[-13051464.678075233,4033976.9295184934],[-13051549.833792884,4034175.3736915537],[-13051627.635118207,4034376.8464596486],[-13051697.975451998,4034581.072939005],[-13051760.758364337,4034787.774459306],[-13051815.897728194,4034996.668942788],[-13051863.317839118,4035207.471288143],[-13051902.953520777,4035419.8937587035],[-13051934.750216182,4035633.646374418],[-13051958.66406449,4035848.4373069927],[-13051974.661963273,4036063.9732777984],[-13051982.72161612,4036279.9599578865],[-13051982.831565524,4036496.1023696284],[-13051974.99121098,4036712.1052894387],[-13051959.210812267,4036927.6736510037],[-13051935.511477888,4037142.51294846],[-13051903.925138671,4037356.3296390288],[-13051864.494506566,4037568.831544467],[-13051817.273018658,4037779.7282508705],[-13051762.324766466,4037988.73150621],[-13051699.724410666,4038195.5556151094],[-13051629.557081213,4038399.9178302647],[-13051551.91826315,4038601.5387400175],[-13051466.913668117,4038800.1426515025],[-13051374.65909179,4038995.4579688753],[-13051275.280257424,4039187.2175660348],[-13051168.91264569,4039375.1591534214],[-13051055.701311052,4039559.02563827],[-13050935.800684895,4039738.565477884],[-13050809.374365715,4039913.53302541],[-13050676.59489659,4040083.688867654],[-13050537.643530292,4040248.8001544354],[-13050392.709982295,4040408.640918997],[-13050241.992172085,4040562.9923891155],[-13050085.695953047,4040711.6432883553],[-13049924.034831356,4040854.3901271126],[-13049757.22967422,4040991.037483034],[-13049585.508407889,4041121.39827038],[-13049409.105705854,4041245.2939979737],[-13049228.262667634,4041362.5550153977],[-13049043.226488618,4041473.0207470134],[-13048854.25012142,4041576.5399135537],[-13048661.5919292,4041672.970740913],[-13048465.51533143,4041762.18115589],[-13048266.288442621,4041844.048968532],[-13048064.183704471,4041918.4620409193],[-13047859.477511989,4041985.318442045],[-13047652.4498341,4042044.526588642],[-13047443.38382922,4042096.0053717387],[-13047232.56545642,4042139.6842687475],[-13047020.28308264,4042175.50344092],[-13046806.827086546,4042203.4138160753],[-13046592.489459574,4042223.3771564295],[-13046377.563404717,4042235.3661114466],[-13046162.342933612,4042239.364255682]]],"spatialReference":{"wkid":102100,"latestWkid":3857}},"attributes":{"ID":"0","OBJECTID":1,"sourceCountry":"US","areaType":"RingBuffer","bufferUnits":"esriMiles","bufferUnitsAlias":"Miles","bufferRadii":3,"aggregationMethod":"BlockApportionment:US.BlockGroups","radiusIndex":0}}]}}}

0 Kudos