Skip to main content

I get a response from an API GET request in JSON and it contains the coordinates for a polygon.

{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2022 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":r{"estimatedTotal":1,"resources":a{"__type":"IsochroneResponse:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","dataSourcesUsed":o5],"origin":{"latitude":-34.021682824034,"longitude":18.4837339189645},"polygons":4{"coordinates":lon-34.0224675816069,18.47607560705454],[-34.021900339603782,18.476424942466956],7-34.021834632851942,18.47667223294113],7-34.021763236949283,18.4766453367028],.-34.02119900085917,18.477001621671914],.-34.021216553524575,18.477231713278478],7-34.020956999043712,18.477130968901353],7-34.020613182625453,18.477165228610041],7-34.020460500759683,18.47738177759841],7-34.020197274110672,18.477411260748216],7-34.020028031581866,18.477656322794978],7-34.019802103094847,18.477680432421995],7-34.019580702909352,18.477998187715652],7-34.019601606286329,18.478280685384213],7-34.019283631607479,18.478160238254329],8-34.018940023376381,18.478197389117021],8-34.018722648397407,18.47851010213002],7-34.018528104661172,18.478413958150266],7-34.01820967392387,18.478573394162236],7-34.01813108338073,18.478802746305377],7-34.018099714056845,18.47879072486916],7-34.018099677466253,18.478790863849508],7-34.018099330523377,18.47879218163267],7-34.017970372857704,18.479281993021754],7-34.017639074467681,18.479154360387163],9-34.017072945763594,18.479506272203515],9-34.0170920692713,18.47977598441711],.-34.016793995381306,18.479663696106591],7-34.016669161449684,18.479677428124653],9-34.016573522458877,18.479580334717131],9-34.016006999468921,18.479931326036215],9-34.015912278815946,18.480290824496546],9-34.015834692088688,18.480261149155183],0-34.0154909990064,18.480297151390484],4-34.01537047750454,18.480469549052184],8-34.0150520008598,18.480483053639635],4-34.014891245234551,18.480690232564069],0-34.014580191498766,18.480550872376835],0-34.014006360267977,18.480854633150074],0-34.014240674132253,18.481553169575861],0-34.014917772678047,18.481918272714221],1-34.014944781118892,18.481918616811349],1-34.014966418962409,18.481940321058904],1-34.014981010804057,18.481945853677598],1-34.014821986407462,18.482189951276819],1-34.015126562853268,18.482855585954933],2-34.015437923088477,18.482968524449607],2-34.015308968541127,18.483155129847685],2-34.015340905001729,18.483567656598783],3-34.015581183949571,18.483807116203618],3-34.015542747650215,18.483857201467881],3-34.01580779728463,18.48455141641228],4-34.01689449527273,18.485044021956572],4-34.0169231541725,18.485042336320952],4-34.021184554353411,18.486918063330727],5-34.021192929046379,18.486926897273868],6-34.021669844780483,18.48713483418943],8-34.021681195787274,18.487267644578697],8-34.021929685696385,18.487528684644019],7-34.025207993561445,18.488951158754297],7-34.025548806145046,18.488933010843251],8-34.025624141281114,18.488835949374547],8-34.025894926614114,18.488810963573119],8-34.0260995406635,18.488093399742848],4-34.025882985623319,18.487857532099572],8-34.025971214585958,18.48777024410462],8-34.026685957869965,18.48804046705963],4-34.0266868438813,18.488040803352717],.-34.026687323991638,18.488040983554118],8-34.026697057307004,18.488003502684709],8-34.026822573541146,18.488065540915475],8-34.027141005087628,18.487906092431633],8-34.027246695005537,18.487597627270418],7-34.027363296672711,18.487657098280618],7-34.027967051385232,18.487324502040963],7-34.028073171360539,18.486926280959285],7-34.028526131863913,18.487098807818242],6-34.029091286639357,18.486744600394335],7-34.028796370887747,18.48606580630863],8-34.028346243706125,18.485894364071445],8-34.028457452663879,18.485471149615019],5-34.028127541736993,18.484778819328689],5-34.027794171201627,18.484687275441306],4-34.027947856947556,18.484466742407083],4-34.027652802915249,18.483788044087579],4-34.027338902897689,18.483668591029684],3-34.027460271376796,18.483190892391391],3-34.0271634230525,18.482514611812586],4-34.027065202404287,18.482525286226121],2-34.027087320528523,18.48249364581288],8-34.02679312704953,18.481814415637444],4-34.026502839766117,18.48170336061084],8-34.026633173274639,18.481516033468804],8-34.026602402199465,18.481103324353395],1-34.026475166370844,18.480975629426688],1-34.026479007465724,18.480961216729682],0-34.026451353816888,18.480548191188376],0-34.026194129638355,18.480285239303104],0-34.026179936050973,18.480099599983987],0-34.025914698298529,18.47983462787905],8-34.025612204207377,18.4797207516613],.-34.025750122150541,18.479530791543453],4-34.025466556825819,18.478845082473086],9-34.025442160079578,18.478835137255512],8-34.025502294177549,18.478605759011014],8-34.025209211723123,18.477925848905244],8-34.024643105574825,18.478277842637151],7-34.024582356733106,18.478509565998916],8-34.024530160100589,18.478491292639347],8-34.0239720216991,18.478861182861376],4-34.023995024268551,18.479107858623088],8-34.023711110040232,18.478999560985887],9-34.02369685843221,18.47878958296112],4-34.023511032424771,18.478600044901057],7-34.023484039584922,18.478256056805524],8-34.023218274307013,18.477991856465636],8-34.022925210673833,18.4778824656244],4-34.023056825350132,18.477689710614595],4-34.022756105751128,18.477014647618418],7-34.022695843317315,18.476992520407869],7-34.022758460142889,18.476756859198957],6-34.0224675816069,18.47607560705454]]]}]}]}],"statusCode":200,"statusDescription":"OK","traceId":"5828fe21e6f141b2a49cc0b8d0ad6760|DU0000276C|0.0.0.0|DU000005EB,DU00001F72"}

Is there a way for me to extract the polygon definition from the JSON and (a) write it to a shapefile and (b) use it as a spatial filter?

 

Thanks,

 

tC/.

I do not think this is a standard json geometry structure, like Esri JSON or GeoJSON. But you can always extract the coordinates using a JSONFragmenter , create the points using a VertexCreator and build a polygon using a LineBuilder. Attached a workspace demonstrating this.

 

result 


Reply