You will learn: how to buffer and intersect points and polygons using the ArcGIS Geometry Service.
The ArcGIS Geometry Serivice can perform sophisticated spatial operations with geometry such as buffering, projecting, simplification, calculating areas and lengths, and determining spatial relationships. If you want to create an application that can create a buffer and determine if a point intersects the geometry, you can use the ArcGIS REST API and the buffer
and relation
operation. All you need to do is pass in the geometry, distance, and spatial relationship to use, and the results will be returned. To learn more about all of the possible geometric operations, please visit the documentation.
In this tutorial you will use the ArcGIS REST API to access the ArcGIS Geometry Service to create a buffer and determine if it insects a point.
Install Postman to execute HTTP requests. Go to this tutorial if you need an access token.
Open Postman and click [+] in the tab bar to create a new request.
In the new tab, set the following:
POST
https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/buffer
Click on Body > x-www-form-urlencoded and add the following Key/Value pairs:
f
: json
inSr
: 4326
unit
: 9002
distances
: 1000
geometries
:{
"geometryType": "esriGeometryPoint",
"geometries": [
{
"x": -118.80836,
"y": 34.00217
}
]
}
Click Send to run the request.
In the response window, click Pretty > JSON. The geometries
property contains the polygon that was created. A polygon consists of one or more rings
. In this case there was only one geometry and ring, but it contains many points that make up the buffer around the point.
{
"geometries": [
{
"rings": [
[
[
-118.80836000000002,
34.004917865738584
],
[
-118.80819152891284,
34.00491428119004
],
[
-118.80802349738985,
34.00490353689699
],
[
-118.80785634384807,
34.004885660892718
],
[
-118.80769050441303,
34.004860699818082
],
[
-118.80752641178064,
34.004828718799772
],
[
-118.80736449408786,
34.004789801280346
],
[
-118.80720517379535,
34.004744048800461
],
[
-118.80704886658502,
34.004691580733834
],
[
-118.80689598027504,
34.004632533975759
],
[
-118.8067469137558,
34.004567062585771
],
[
-118.80660205594874,
34.004495337385649
],
[
-118.80646178479165,
34.004417545513526
],
[
-118.8063264662523,
34.004333889935609
],
[
-118.8061964533736,
34.004244588916428
],
[
-118.80607208535235,
34.004149875449244
],
[
-118.80595368665435,
34.004049996648028
],
[
-118.8058415661677,
34.00394521310259
],
[
-118.80573601639708,
34.003835798198544
],
[
-118.80563731270067,
34.003722037403897
],
[
-118.80554571257183,
34.003604227524114
],
[
-118.80546145496743,
34.003482675927614
],
[
-118.80538475968476,
34.003357699743709
],
[
-118.8053158267882,
34.003229625035132
],
[
-118.80525483608757,
34.003098785947181
],
[
-118.80520194666933,
34.002965523835833
],
[
-118.80515729648184,
34.002830186377103
],
[
-118.80512100197592,
34.002693126659899
],
[
-118.80509315780128,
34.002554702264668
],
[
-118.8050738365601,
34.002415274330538
],
[
-118.80506308861794,
34.002275206613056
],
[
-118.80506094197291,
34.002134864535094
],
[
-118.80506740218294,
34.001994614233553
],
[
-118.8050824523518,
34.001854821604148
],
[
-118.80510605317356,
34.001715851346759
],
[
-118.80513814303559,
34.001578066014098
],
[
-118.8051786381798,
34.001441825065868
],
[
-118.80522743292146,
34.001307483931001
],
[
-118.80528439992533,
34.00117539308053
],
[
-118.80534939053827,
34.0010458971133
],
[
-118.80542223517742,
34.000919333857134
],
[
-118.80550274377285,
34.000796033487518
],
[
-118.8055907062638,
34.000676317666418
],
[
-118.80568589314683,
34.000560498703251
],
[
-118.8057880560749,
34.000448878740194
],
[
-118.80589692850538,
34.00034174896421
],
[
-118.8060122263955,
34.000239388847469
],
[
-118.80613364894351,
34.000142065418444
],
[
-118.80626087937353,
34.000050032565447
],
[
-118.80639358576178,
33.999963530374423
],
[
-118.8065314219027,
33.999882784502823
],
[
-118.80667402821182,
33.999808005590992
],
[
-118.80682103266393,
33.999739388712882
],
[
-118.80697205176332,
33.999677112867232
],
[
-118.80712669154416,
33.999621340510757
],
[
-118.80728454859788,
33.999572217134464
],
[
-118.80744521112554,
33.999529870884217
],
[
-118.80760826001161,
33.999494412226511
],
[
-118.80777326991718,
33.999465933660446
],
[
-118.80793981038913,
33.999444509476405
],
[
-118.80810744698287,
33.99943019556239
],
[
-118.80827574239521,
33.999423029258239
],
[
-118.80844425760482,
33.999423029258239
],
[
-118.80861255301716,
33.99943019556239
],
[
-118.8087801896109,
33.999444509476405
],
[
-118.80894673008287,
33.999465933660439
],
[
-118.80911173998842,
33.999494412226511
],
[
-118.80927478887449,
33.999529870884217
],
[
-118.80943545140215,
33.999572217134464
],
[
-118.80959330845587,
33.999621340510764
],
[
-118.8097479482367,
33.999677112867232
],
[
-118.80989896733611,
33.999739388712882
],
[
-118.81004597178821,
33.999808005590992
],
[
-118.81018857809732,
33.999882784502823
],
[
-118.81032641423825,
33.999963530374423
],
[
-118.8104591206265,
34.000050032565447
],
[
-118.81058635105651,
34.000142065418444
],
[
-118.81070777360455,
34.000239388847469
],
[
-118.81082307149465,
34.00034174896421
],
[
-118.81093194392513,
34.000448878740194
],
[
-118.81103410685321,
34.000560498703251
],
[
-118.81112929373623,
34.000676317666418
],
[
-118.81121725622718,
34.000796033487518
],
[
-118.81129776482261,
34.000919333857134
],
[
-118.81137060946176,
34.0010458971133
],
[
-118.8114356000747,
34.00117539308053
],
[
-118.81149256707859,
34.001307483931001
],
[
-118.81154136182023,
34.001441825065868
],
[
-118.81158185696444,
34.001578066014105
],
[
-118.81161394682648,
34.001715851346759
],
[
-118.81163754764823,
34.001854821604141
],
[
-118.81165259781709,
34.001994614233553
],
[
-118.81165905802712,
34.002134864535094
],
[
-118.81165691138209,
34.002275206613056
],
[
-118.81164616343993,
34.002415274330545
],
[
-118.81162684219875,
34.002554702264675
],
[
-118.81159899802411,
34.002693126659892
],
[
-118.81156270351819,
34.002830186377111
],
[
-118.81151805333072,
34.002965523835833
],
[
-118.81146516391246,
34.003098785947181
],
[
-118.81140417321183,
34.003229625035132
],
[
-118.81133524031527,
34.003357699743709
],
[
-118.8112585450326,
34.003482675927614
],
[
-118.8111742874282,
34.003604227524114
],
[
-118.81108268729936,
34.003722037403904
],
[
-118.81098398360295,
34.003835798198544
],
[
-118.81087843383234,
34.00394521310259
],
[
-118.8107663133457,
34.004049996648028
],
[
-118.81064791464769,
34.004149875449244
],
[
-118.81052354662643,
34.004244588916428
],
[
-118.81039353374773,
34.004333889935609
],
[
-118.81025821520838,
34.004417545513526
],
[
-118.81011794405129,
34.004495337385649
],
[
-118.80997308624423,
34.004567062585771
],
[
-118.80982401972499,
34.004632533975759
],
[
-118.80967113341502,
34.004691580733841
],
[
-118.80951482620468,
34.004744048800461
],
[
-118.80935550591217,
34.004789801280339
],
[
-118.80919358821939,
34.004828718799772
],
[
-118.809029495587,
34.004860699818082
],
[
-118.80886365615196,
34.004885660892711
],
[
-118.80869650261018,
34.004903536896983
],
[
-118.80852847108719,
34.00491428119004
],
[
-118.80836000000002,
34.004917865738584
]
]
]
}
]
}
Copy the geometry value above as you will need it for the next step.
Open Postman and click [+] in the tab bar to create a new request.
In the new tab, set the following:
POST
http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/relation
Click on Body and add the following Key/Value pairs:
f
: json
sr
: 4326
relation
: esriGeometryRelationIntersection
geometries1
:{
"geometryType":"esriGeometryPoint",
"geometries":[
{
"x":-118.80836,
"y":34.00217
}
]
}
geometries2
:{
"geometryType":"esriGeometryPolygon",
"geometries":[
{
"rings":[
[
[
-118.80836000000002,
34.004917865738584
],
[
-118.80819152891284,
34.00491428119004
],
[
-118.80802349738985,
34.00490353689699
],
[
-118.80785634384807,
34.004885660892718
],
[
-118.80769050441303,
34.004860699818082
],
[
-118.80752641178064,
34.004828718799772
],
[
-118.80736449408786,
34.004789801280346
],
[
-118.80720517379535,
34.004744048800461
],
[
-118.80704886658502,
34.004691580733834
],
[
-118.80689598027504,
34.004632533975759
],
[
-118.8067469137558,
34.004567062585771
],
[
-118.80660205594874,
34.004495337385649
],
[
-118.80646178479165,
34.004417545513526
],
[
-118.8063264662523,
34.004333889935609
],
[
-118.8061964533736,
34.004244588916428
],
[
-118.80607208535235,
34.004149875449244
],
[
-118.80595368665435,
34.004049996648028
],
[
-118.8058415661677,
34.00394521310259
],
[
-118.80573601639708,
34.003835798198544
],
[
-118.80563731270067,
34.003722037403897
],
[
-118.80554571257183,
34.003604227524114
],
[
-118.80546145496743,
34.003482675927614
],
[
-118.80538475968476,
34.003357699743709
],
[
-118.8053158267882,
34.003229625035132
],
[
-118.80525483608757,
34.003098785947181
],
[
-118.80520194666933,
34.002965523835833
],
[
-118.80515729648184,
34.002830186377103
],
[
-118.80512100197592,
34.002693126659899
],
[
-118.80509315780128,
34.002554702264668
],
[
-118.8050738365601,
34.002415274330538
],
[
-118.80506308861794,
34.002275206613056
],
[
-118.80506094197291,
34.002134864535094
],
[
-118.80506740218294,
34.001994614233553
],
[
-118.8050824523518,
34.001854821604148
],
[
-118.80510605317356,
34.001715851346759
],
[
-118.80513814303559,
34.001578066014098
],
[
-118.8051786381798,
34.001441825065868
],
[
-118.80522743292146,
34.001307483931001
],
[
-118.80528439992533,
34.00117539308053
],
[
-118.80534939053827,
34.0010458971133
],
[
-118.80542223517742,
34.000919333857134
],
[
-118.80550274377285,
34.000796033487518
],
[
-118.8055907062638,
34.000676317666418
],
[
-118.80568589314683,
34.000560498703251
],
[
-118.8057880560749,
34.000448878740194
],
[
-118.80589692850538,
34.00034174896421
],
[
-118.8060122263955,
34.000239388847469
],
[
-118.80613364894351,
34.000142065418444
],
[
-118.80626087937353,
34.000050032565447
],
[
-118.80639358576178,
33.999963530374423
],
[
-118.8065314219027,
33.999882784502823
],
[
-118.80667402821182,
33.999808005590992
],
[
-118.80682103266393,
33.999739388712882
],
[
-118.80697205176332,
33.999677112867232
],
[
-118.80712669154416,
33.999621340510757
],
[
-118.80728454859788,
33.999572217134464
],
[
-118.80744521112554,
33.999529870884217
],
[
-118.80760826001161,
33.999494412226511
],
[
-118.80777326991718,
33.999465933660446
],
[
-118.80793981038913,
33.999444509476405
],
[
-118.80810744698287,
33.99943019556239
],
[
-118.80827574239521,
33.999423029258239
],
[
-118.80844425760482,
33.999423029258239
],
[
-118.80861255301716,
33.99943019556239
],
[
-118.8087801896109,
33.999444509476405
],
[
-118.80894673008287,
33.999465933660439
],
[
-118.80911173998842,
33.999494412226511
],
[
-118.80927478887449,
33.999529870884217
],
[
-118.80943545140215,
33.999572217134464
],
[
-118.80959330845587,
33.999621340510764
],
[
-118.8097479482367,
33.999677112867232
],
[
-118.80989896733611,
33.999739388712882
],
[
-118.81004597178821,
33.999808005590992
],
[
-118.81018857809732,
33.999882784502823
],
[
-118.81032641423825,
33.999963530374423
],
[
-118.8104591206265,
34.000050032565447
],
[
-118.81058635105651,
34.000142065418444
],
[
-118.81070777360455,
34.000239388847469
],
[
-118.81082307149465,
34.00034174896421
],
[
-118.81093194392513,
34.000448878740194
],
[
-118.81103410685321,
34.000560498703251
],
[
-118.81112929373623,
34.000676317666418
],
[
-118.81121725622718,
34.000796033487518
],
[
-118.81129776482261,
34.000919333857134
],
[
-118.81137060946176,
34.0010458971133
],
[
-118.8114356000747,
34.00117539308053
],
[
-118.81149256707859,
34.001307483931001
],
[
-118.81154136182023,
34.001441825065868
],
[
-118.81158185696444,
34.001578066014105
],
[
-118.81161394682648,
34.001715851346759
],
[
-118.81163754764823,
34.001854821604141
],
[
-118.81165259781709,
34.001994614233553
],
[
-118.81165905802712,
34.002134864535094
],
[
-118.81165691138209,
34.002275206613056
],
[
-118.81164616343993,
34.002415274330545
],
[
-118.81162684219875,
34.002554702264675
],
[
-118.81159899802411,
34.002693126659892
],
[
-118.81156270351819,
34.002830186377111
],
[
-118.81151805333072,
34.002965523835833
],
[
-118.81146516391246,
34.003098785947181
],
[
-118.81140417321183,
34.003229625035132
],
[
-118.81133524031527,
34.003357699743709
],
[
-118.8112585450326,
34.003482675927614
],
[
-118.8111742874282,
34.003604227524114
],
[
-118.81108268729936,
34.003722037403904
],
[
-118.81098398360295,
34.003835798198544
],
[
-118.81087843383234,
34.00394521310259
],
[
-118.8107663133457,
34.004049996648028
],
[
-118.81064791464769,
34.004149875449244
],
[
-118.81052354662643,
34.004244588916428
],
[
-118.81039353374773,
34.004333889935609
],
[
-118.81025821520838,
34.004417545513526
],
[
-118.81011794405129,
34.004495337385649
],
[
-118.80997308624423,
34.004567062585771
],
[
-118.80982401972499,
34.004632533975759
],
[
-118.80967113341502,
34.004691580733841
],
[
-118.80951482620468,
34.004744048800461
],
[
-118.80935550591217,
34.004789801280339
],
[
-118.80919358821939,
34.004828718799772
],
[
-118.809029495587,
34.004860699818082
],
[
-118.80886365615196,
34.004885660892711
],
[
-118.80869650261018,
34.004903536896983
],
[
-118.80852847108719,
34.00491428119004
]
]
]
}
]
}
Click Send to run the request.
In the response window, click Pretty > JSON. It should look something like this:
{
"relations": [
{
"geometry1Index": 0,
"geometry2Index": 0
}
]
}
Find the relations
property array. Each item in the array is an object with geometry1Index
and geometry2Index
indicating the zero-based index of the features fulfilling the relationship in the geometry1
and geometry2
arrays.
In Body, change the following to input a point that is well outside of the buffer:
{
"geometryType":"esriGeometryPoint",
"geometries":[
{
"x":-120
"y":44
}
]
}
Click Send to run the request. Notice the return value indicates there is no relationship between the geometries.
{
"relations": []
}
Save the request.
You have successfully buffered a point and determined the relationship between a point and the buffer.
Try other methods on the Geometry Service like using areas and lengths to calculate the length or area of a shape.