SSURGO Soil

The SURGGO Soils API provides soil type and average of the soil type attribute (e.g., NCCPI) by field for a shape entered.

In [20]:
import requests
import json
import time
from pandas.io.json import json_normalize
import pandas as pd
from collections import defaultdict
import math
import requests, zipfile, io
import geopandas as gpd
%matplotlib inline

API details

Request URL: https://ag-analytics.azure-api.net/ssurgosoil/get[?inputShape][&inputFields]

Parameters:

inputShape (optional) ESRI Polygon shape.

The inputShape should have the Albers (“wkid”: 5070) spatial reference. The shape information for field is esriGeometryPolygon format. Standard open source JavaScript front-end libraries (e.g., Leaflet) can be used to structure the shape. See example request below, in which "spatialReference": {"wkid": 5070} is required

inputFields (optional) The metrics to return with the format “TableName_SoilTypeName”.

In order to get Ocp-Apim-Subscription-Key, please click on this link https://analytics.ag/Session/SignInToAPIPayment

Request Parameters

In [21]:
inputShape={"geometryType":"esriGeometryPolygon","features":[{"geometry":{"rings":[[[-89.045774,43.730605],[-89.04577,43.730488],[-89.045722,43.729998],[-89.045789,43.729653],[-89.045661,43.72961],[-89.045635,43.729782],[-89.045644,43.730045],[-89.045653,43.730308],[-89.045651,43.730607],[-89.041228,43.730676],[-89.041171,43.728908],[-89.041111,43.727076],[-89.042892,43.727044],[-89.044665,43.727018],[-89.046178,43.726999],[-89.046237,43.730597],[-89.045774,43.730605]]],"spatialReference":{"wkid":4326}}}]}
inputFields="nccpi2all"

headers={'Ocp-Apim-Subscription-Key': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}
           

API Function

In [22]:
def get_SSURGO_Soil_type(inputShape,inputFields,headers):
    try:
        url = "https://ag-analytics.azure-api.net/ssurgosoil/get?inputShape={}&inputFields={}".format(inputShape,inputFields)
     
        response = (requests.get(url,headers=headers).text)
        
        response_json = json.loads(response)
        print(response_json)
        time.sleep(0.5)
        return response_json
    
    except Exception as e:
        raise e

Calling API Function and print output

In [23]:
ssurgo=get_SSURGO_Soil_type(inputShape,inputFields,headers)
{'results': [{'paramName': 'output1', 'dataType': 'GPRecordSet', 'value': {'displayFieldName': '', 'fields': [{'name': 'FID', 'type': 'esriFieldTypeOID', 'alias': 'FID'}, {'name': 'intersect_FID_inputShapeProjected', 'type': 'esriFieldTypeInteger', 'alias': 'intersect.FID_inputShapeProjected'}, {'name': 'FREQUENCY', 'type': 'esriFieldTypeInteger', 'alias': 'FREQUENCY'}, {'name': 'SUM_wa_nccpi2all', 'type': 'esriFieldTypeDouble', 'alias': 'SUM_wa_nccpi2all'}], 'features': [{'attributes': {'FID': 1, 'intersect_FID_inputShapeProjected': 0, 'FREQUENCY': 5, 'SUM_wa_nccpi2all': 0.816984696980092}}], 'exceededTransferLimit': False}}, {'paramName': 'output2', 'dataType': 'GPFeatureRecordSetLayer', 'value': {'displayFieldName': '', 'geometryType': 'esriGeometryPolygon', 'spatialReference': {'wkid': 5070, 'latestWkid': 5070}, 'fields': [{'name': 'FID', 'type': 'esriFieldTypeOID', 'alias': 'FID'}, {'name': 'FID_inputShapeProjected', 'type': 'esriFieldTypeInteger', 'alias': 'FID_inputShapeProjected'}, {'name': 'OBJECTID', 'type': 'esriFieldTypeInteger', 'alias': 'OBJECTID'}, {'name': 'Shape_Leng', 'type': 'esriFieldTypeDouble', 'alias': 'Shape_Leng'}, {'name': 'FID_soilmu_a_wi047', 'type': 'esriFieldTypeInteger', 'alias': 'FID_soilmu_a_wi047'}, {'name': 'AREASYMBOL', 'type': 'esriFieldTypeString', 'alias': 'AREASYMBOL', 'length': 20}, {'name': 'SPATIALVER', 'type': 'esriFieldTypeInteger', 'alias': 'SPATIALVER'}, {'name': 'MUSYM', 'type': 'esriFieldTypeString', 'alias': 'MUSYM', 'length': 6}, {'name': 'MUKEY', 'type': 'esriFieldTypeString', 'alias': 'MUKEY', 'length': 30}, {'name': 'Shape_Area1', 'type': 'esriFieldTypeSingle', 'alias': 'Shape_Area1'}, {'name': 'Shape_Length', 'type': 'esriFieldTypeDouble', 'alias': 'Shape_Length'}, {'name': 'Shape_Area', 'type': 'esriFieldTypeDouble', 'alias': 'Shape_Area'}], 'features': [{'attributes': {'FID': 1, 'FID_inputShapeProjected': 0, 'OBJECTID': 1, 'Shape_Leng': 0, 'FID_soilmu_a_wi047': 3546, 'AREASYMBOL': 'WI047', 'SPATIALVER': 3, 'MUSYM': 'PnB', 'MUKEY': '423737', 'Shape_Area1': 89316.59, 'Shape_Length': 2718.1719578335433, 'Shape_Area': 89316.59387743715}, 'geometry': {'rings': [[[557820.4662999995, 2324649.4618999995], [557818.8460000008, 2324653.5985000003], [557812.8883999996, 2324657.2312000003], [557800.5229999982, 2324657.5807000007], [557779.6020000018, 2324648.0755000003], [557761.2644999996, 2324634.9716], [557730.2782000005, 2324620.5649999995], [557694.2923999988, 2324613.274700001], [557628.8889000006, 2324610.0911999997], [557607.0353000015, 2324604.287799999], [557598.8046000004, 2324597.9079], [557592.4741999991, 2324595.774599999], [557583.2961999997, 2324588.5189999994], [557574.7164999992, 2324584.1390000004], [557548.0430999994, 2324586.6843], [557531.3726000004, 2324583.2115], [557511.2032999992, 2324581.6578], [557499.5832999982, 2324574.5983000007], [557492.0885000005, 2324566.640900001], [557488.758200001, 2324565.159], [557466.5661000013, 2324563.4196000006], [557459.6508999988, 2324565.0318], [557426.370099999, 2324557.0785000008], [557424.3255999982, 2324556.035], [557419.1409999989, 2324616.9097000007], [557438.3553000018, 2324620.0518999994], [557448.3308000006, 2324623.0524000004], [557454.4043000005, 2324626.6670999993], [557457.7303000018, 2324627.3495000005], [557460.6457000002, 2324607.1733], [557458.0987999998, 2324568.3904999997], [557468.6917999983, 2324564.3565999996], [557469.3691999987, 2324583.6482999995], [557466.5036999993, 2324612.8608], [557464.9373999983, 2324628.8282999992], [557494.7943000011, 2324634.9542999994], [557566.1699000001, 2324660.2355000004], [557649.7919000015, 2324685.4966], [557704.5821999982, 2324695.1034999993], [557782.1039999984, 2324699.4579000007], [557800.1598000005, 2324707.6023999993], [557814.7098999992, 2324708.987299999], [557820.4662999995, 2324649.4618999995]], [[557465.4611000009, 2324673.9691000003], [557466.0520000011, 2324675.8027], [557500.5203999989, 2324679.0833], [557494.7503999993, 2324676.022500001], [557477.4761999995, 2324672.6931999996], [557469.8775999993, 2324671.854800001], [557465.4611000009, 2324673.9691000003]], [[557846.3504999988, 2324382.2983], [557833.9034000002, 2324376.446799999], [557820.9580000006, 2324366.4952000007], [557807.7144999988, 2324359.5035999995], [557785.6607999988, 2324353.478700001], [557777.1598999985, 2324345.4473], [557776.2355000004, 2324341.6849000007], [557777.7243999988, 2324338.1182000004], [557782.9510000013, 2324333.6066999994], [557786.1922999993, 2324332.625499999], [557801.6805999987, 2324333.8365], [557807.9959999993, 2324332.499399999], [557815.4114999995, 2324334.9187000003], [557849.2771000005, 2324337.853], [557850.635400001, 2324338.1587000005], [557853.4576999992, 2324309.085999999], [557711.2019000016, 2324295.071900001], [557569.5368999988, 2324281.7751], [557528.9382999986, 2324278.0851000007], [557539.9193999991, 2324289.6788999997], [557545.5368000008, 2324293.4476999994], [557558.0225000009, 2324308.2038000003], [557559.4244000018, 2324312.0760999992], [557557.3277999982, 2324323.3813000005], [557545.0788000003, 2324332.2541000005], [557541.2204000019, 2324333.190300001], [557443.7547000013, 2324327.9102999996], [557436.6444000006, 2324411.3957], [557453.7540999986, 2324415.6916000005], [557512.6849999987, 2324441.8792000003], [557572.8245999999, 2324453.415100001], [557579.8768999986, 2324451.7753999997], [557596.6926000006, 2324452.352], [557620.3495999984, 2324443.865700001], [557626.1796999983, 2324439.3982999995], [557631.9252999984, 2324428.1733], [557641.8282999992, 2324420.9476999994], [557645.3498999998, 2324420.0056999996], [557652.8691000007, 2324421.194700001], [557668.9640000015, 2324427.7387000006], [557711.5342000015, 2324458.3543], [557752.8828999996, 2324491.0935999993], [557788.7650000006, 2324513.9613000005], [557794.7087999992, 2324520.9988], [557796.0287000015, 2324524.8839], [557794.0471000001, 2324550.2443000004], [557798.7996000014, 2324574.9921000004], [557810.7916000001, 2324603.0841000006], [557814.1645000018, 2324616.8532999996], [557820.8449999988, 2324631.127699999], [557821.7316999994, 2324636.3763999995], [557833.7023999989, 2324512.5889], [557846.3504999988, 2324382.2983]]]}}, {'attributes': {'FID': 2, 'FID_inputShapeProjected': 0, 'OBJECTID': 1, 'Shape_Leng': 0, 'FID_soilmu_a_wi047': 6625, 'AREASYMBOL': 'WI047', 'SPATIALVER': 3, 'MUSYM': 'GrC2', 'MUKEY': '423689', 'Shape_Area1': 7704.103, 'Shape_Length': 902.5427762698405, 'Shape_Area': 7704.103014628658}, 'geometry': {'rings': [[[557464.9373999983, 2324628.8282999992], [557463.6380999982, 2324642.0732000005], [557461.5467999987, 2324672.6141999997], [557465.4611000009, 2324673.9691000003], [557469.8775999993, 2324671.854800001], [557477.4761999995, 2324672.6931999996], [557494.7503999993, 2324676.022500001], [557500.5203999989, 2324679.0833], [557800.1598000005, 2324707.6023999993], [557782.1039999984, 2324699.4579000007], [557704.5821999982, 2324695.1034999993], [557649.7919000015, 2324685.4966], [557566.1699000001, 2324660.2355000004], [557494.7943000011, 2324634.9542999994], [557464.9373999983, 2324628.8282999992]], [[557457.7303000018, 2324627.3495000005], [557454.4043000005, 2324626.6670999993], [557448.3308000006, 2324623.0524000004], [557438.3553000018, 2324620.0518999994], [557419.1409999989, 2324616.9097000007], [557414.9552000016, 2324666.0571], [557451.9420000017, 2324670.2448999994], [557452.8077999987, 2324661.4163000006], [557457.7303000018, 2324627.3495000005]]]}}, {'attributes': {'FID': 3, 'FID_inputShapeProjected': 0, 'OBJECTID': 1, 'Shape_Leng': 0, 'FID_soilmu_a_wi047': 6644, 'AREASYMBOL': 'WI047', 'SPATIALVER': 3, 'MUSYM': 'PnA', 'MUKEY': '423736', 'Shape_Area1': 5738.143, 'Shape_Length': 312.3646776108769, 'Shape_Area': 5738.1425977428335}, 'geometry': {'rings': [[[557528.9382999986, 2324278.0851000007], [557448.620000001, 2324270.7849000003], [557443.7547000013, 2324327.9102999996], [557541.2204000019, 2324333.190300001], [557545.0788000003, 2324332.2541000005], [557557.3277999982, 2324323.3813000005], [557559.4244000018, 2324312.0760999992], [557558.0225000009, 2324308.2038000003], [557545.5368000008, 2324293.4476999994], [557539.9193999991, 2324289.6788999997], [557528.9382999986, 2324278.0851000007]]]}}, {'attributes': {'FID': 4, 'FID_inputShapeProjected': 0, 'OBJECTID': 1, 'Shape_Leng': 0, 'FID_soilmu_a_wi047': 8519, 'AREASYMBOL': 'WI047', 'SPATIALVER': 3, 'MUSYM': 'KeC2', 'MUKEY': '423699', 'Shape_Area1': 2100.006, 'Shape_Length': 207.1680308191033, 'Shape_Area': 2100.0064676566676}, 'geometry': {'rings': [[[557850.635400001, 2324338.1587000005], [557849.2771000005, 2324337.853], [557815.4114999995, 2324334.9187000003], [557807.9959999993, 2324332.499399999], [557801.6805999987, 2324333.8365], [557786.1922999993, 2324332.625499999], [557782.9510000013, 2324333.6066999994], [557777.7243999988, 2324338.1182000004], [557776.2355000004, 2324341.6849000007], [557777.1598999985, 2324345.4473], [557785.6607999988, 2324353.478700001], [557807.7144999988, 2324359.5035999995], [557820.9580000006, 2324366.4952000007], [557833.9034000002, 2324376.446799999], [557846.3504999988, 2324382.2983], [557850.635400001, 2324338.1587000005]]]}}, {'attributes': {'FID': 5, 'FID_inputShapeProjected': 0, 'OBJECTID': 1, 'Shape_Leng': 0, 'FID_soilmu_a_wi047': 9703, 'AREASYMBOL': 'WI047', 'SPATIALVER': 3, 'MUSYM': 'PnA', 'MUKEY': '423736', 'Shape_Area1': 47472.36, 'Shape_Length': 1068.94454690616, 'Shape_Area': 47472.363679527836}, 'geometry': {'rings': [[[557820.4662999995, 2324649.4618999995], [557821.7316999994, 2324636.3763999995], [557820.8449999988, 2324631.127699999], [557814.1645000018, 2324616.8532999996], [557810.7916000001, 2324603.0841000006], [557798.7996000014, 2324574.9921000004], [557794.0471000001, 2324550.2443000004], [557796.0287000015, 2324524.8839], [557794.7087999992, 2324520.9988], [557788.7650000006, 2324513.9613000005], [557752.8828999996, 2324491.0935999993], [557711.5342000015, 2324458.3543], [557668.9640000015, 2324427.7387000006], [557652.8691000007, 2324421.194700001], [557645.3498999998, 2324420.0056999996], [557641.8282999992, 2324420.9476999994], [557631.9252999984, 2324428.1733], [557626.1796999983, 2324439.3982999995], [557620.3495999984, 2324443.865700001], [557596.6926000006, 2324452.352], [557579.8768999986, 2324451.7753999997], [557572.8245999999, 2324453.415100001], [557512.6849999987, 2324441.8792000003], [557453.7540999986, 2324415.6916000005], [557436.6444000006, 2324411.3957], [557430.5824000016, 2324482.5722000003], [557448.2575999983, 2324483.4976000004], [557468.2619000003, 2324487.1207999997], [557482.6435999982, 2324492.7511], [557502.3376999982, 2324508.148], [557533.4046999998, 2324525.8791000005], [557545.8044000007, 2324536.652899999], [557558.9089000002, 2324552.7107999995], [557571.800999999, 2324574.7919999994], [557574.7164999992, 2324584.1390000004], [557583.2961999997, 2324588.5189999994], [557592.4741999991, 2324595.774599999], [557598.8046000004, 2324597.9079], [557607.0353000015, 2324604.287799999], [557628.8889000006, 2324610.0911999997], [557694.2923999988, 2324613.274700001], [557730.2782000005, 2324620.5649999995], [557761.2644999996, 2324634.9716], [557779.6020000018, 2324648.0755000003], [557800.5229999982, 2324657.5807000007], [557812.8883999996, 2324657.2312000003], [557818.8460000008, 2324653.5985000003], [557820.4662999995, 2324649.4618999995]]]}}, {'attributes': {'FID': 6, 'FID_inputShapeProjected': 0, 'OBJECTID': 1, 'Shape_Leng': 0, 'FID_soilmu_a_wi047': 9726, 'AREASYMBOL': 'WI047', 'SPATIALVER': 3, 'MUSYM': 'JoA', 'MUKEY': '423691', 'Shape_Area1': 9085.522, 'Shape_Length': 418.58380929664395, 'Shape_Area': 9085.522463692976}, 'geometry': {'rings': [[[557574.7164999992, 2324584.1390000004], [557571.800999999, 2324574.7919999994], [557558.9089000002, 2324552.7107999995], [557545.8044000007, 2324536.652899999], [557533.4046999998, 2324525.8791000005], [557502.3376999982, 2324508.148], [557482.6435999982, 2324492.7511], [557468.2619000003, 2324487.1207999997], [557448.2575999983, 2324483.4976000004], [557430.5824000016, 2324482.5722000003], [557424.3255999982, 2324556.035], [557426.370099999, 2324557.0785000008], [557459.6508999988, 2324565.0318], [557466.5661000013, 2324563.4196000006], [557488.758200001, 2324565.159], [557492.0885000005, 2324566.640900001], [557499.5832999982, 2324574.5983000007], [557511.2032999992, 2324581.6578], [557531.3726000004, 2324583.2115], [557548.0430999994, 2324586.6843], [557574.7164999992, 2324584.1390000004]]]}}, {'attributes': {'FID': 7, 'FID_inputShapeProjected': 0, 'OBJECTID': 1, 'Shape_Leng': 0, 'FID_soilmu_a_wi047': 10405, 'AREASYMBOL': 'WI047', 'SPATIALVER': 3, 'MUSYM': 'PnA', 'MUKEY': '423736', 'Shape_Area1': 176.1223, 'Shape_Length': 96.86505373399999, 'Shape_Area': 176.12231814364918}, 'geometry': {'rings': [[[557465.4611000009, 2324673.9691000003], [557461.5467999987, 2324672.6141999997], [557461.3590999991, 2324675.3560000006], [557466.0520000011, 2324675.8027], [557465.4611000009, 2324673.9691000003]], [[557451.9420000017, 2324670.2448999994], [557414.9552000016, 2324666.0571], [557414.5507000014, 2324670.8059], [557451.5333000012, 2324674.4119000006], [557451.9420000017, 2324670.2448999994]]]}}], 'exceededTransferLimit': False}}, {'paramName': 'output3', 'dataType': 'GPRecordSet', 'value': {'displayFieldName': '', 'fields': [{'name': 'FID', 'type': 'esriFieldTypeOID', 'alias': 'FID'}, {'name': 'intersect_MUKEY', 'type': 'esriFieldTypeString', 'alias': 'intersect.MUKEY', 'length': 30}, {'name': 'intersect_FID_inputShapeProjected', 'type': 'esriFieldTypeInteger', 'alias': 'intersect.FID_inputShapeProjected'}, {'name': 'FREQUENCY', 'type': 'esriFieldTypeInteger', 'alias': 'FREQUENCY'}, {'name': 'MIN_valu1_nccpi2all', 'type': 'esriFieldTypeDouble', 'alias': 'MIN_valu1.nccpi2all'}, {'name': 'SUM_intersect_Shape_Area1', 'type': 'esriFieldTypeDouble', 'alias': 'SUM_intersect.Shape_Area1'}, {'name': 'FIRST_valu1_MUNAME', 'type': 'esriFieldTypeString', 'alias': 'FIRST_valu1.MUNAME', 'length': 214}, {'name': 'wa_nccpi2all', 'type': 'esriFieldTypeDouble', 'alias': 'wa_nccpi2all'}], 'features': [{'attributes': {'FID': 1, 'intersect_MUKEY': '423689', 'intersect_FID_inputShapeProjected': 0, 'FREQUENCY': 1, 'MIN_valu1_nccpi2all': 0.5120000243186951, 'SUM_intersect_Shape_Area1': 7704.10302734375, 'FIRST_valu1_MUNAME': 'Griswold silt loam, 6 to 12 percent slopes, eroded', 'wa_nccpi2all': 0.02441011991292734}}, {'attributes': {'FID': 2, 'intersect_MUKEY': '423691', 'intersect_FID_inputShapeProjected': 0, 'FREQUENCY': 1, 'MIN_valu1_nccpi2all': 0.8429999947547913, 'SUM_intersect_Shape_Area1': 9085.5224609375, 'FIRST_valu1_MUNAME': 'Joy silt loam, 0 to 3 percent slopes', 'wa_nccpi2all': 0.047397488247161265}}, {'attributes': {'FID': 3, 'intersect_MUKEY': '423699', 'intersect_FID_inputShapeProjected': 0, 'FREQUENCY': 1, 'MIN_valu1_nccpi2all': 0.5149999856948853, 'SUM_intersect_Shape_Area1': 2100.00634765625, 'FIRST_valu1_MUNAME': 'Kidder loam, 6 to 12 percent slopes, eroded', 'wa_nccpi2all': 0.006692766504442087}}, {'attributes': {'FID': 4, 'intersect_MUKEY': '423736', 'intersect_FID_inputShapeProjected': 0, 'FREQUENCY': 3, 'MIN_valu1_nccpi2all': 0.8450000286102295, 'SUM_intersect_Shape_Area1': 53386.628173828125, 'FIRST_valu1_MUNAME': 'Plano silt loam, till substratum,  0 to 2 percent slopes', 'wa_nccpi2all': 0.2791689191979303}}, {'attributes': {'FID': 5, 'intersect_MUKEY': '423737', 'intersect_FID_inputShapeProjected': 0, 'FREQUENCY': 1, 'MIN_valu1_nccpi2all': 0.8309999704360962, 'SUM_intersect_Shape_Area1': 89316.59375, 'FIRST_valu1_MUNAME': 'Plano silt loam, till substratum,  2 to 6 percent slopes', 'wa_nccpi2all': 0.459315403117631}}], 'exceededTransferLimit': False}}], 'messages': []}

Displaying Tabular Output

In [24]:
totalAcres=0

mukeydict={}
for value in ssurgo['results'][2]['value']['features']:
    
    totalAcres+=value['attributes']['SUM_intersect_Shape_Area1']*0.000247105 #sq meter to acres calc
    
df=defaultdict(list)
for value in ssurgo['results'][2]['value']['features']:
    mukeydict[value['attributes']['intersect_MUKEY']]=value['attributes']['FIRST_valu1_MUNAME']
    df['soil_Name'].append(value['attributes']['FIRST_valu1_MUNAME'])
    partAcres=value['attributes']['SUM_intersect_Shape_Area1']*0.000247105
    percentAcres=(partAcres/totalAcres)*100
    df['Acres'].append(round(partAcres*100)/100)
    df['Percent'].append(round(percentAcres*100)/100)
    df['Avg nccpi'].append(value['attributes']['MIN_valu1_nccpi2all'])
    
    
ssurgodf=pd.DataFrame.from_dict(df)
ssurgodf
Out[24]:
soil_Name Acres Percent Avg nccpi
0 Griswold silt loam, 6 to 12 percent slopes, er... 1.90 4.77 0.512
1 Joy silt loam, 0 to 3 percent slopes 2.25 5.62 0.843
2 Kidder loam, 6 to 12 percent slopes, eroded 0.52 1.30 0.515
3 Plano silt loam, till substratum, 0 to 2 perc... 13.19 33.04 0.845
4 Plano silt loam, till substratum, 2 to 6 perc... 22.07 55.27 0.831

Displaying Map

In [25]:
for params in ssurgo['results']:
    if params['paramName']=='output2':
        file=open('./jsonfiles/ssurgodata1.json','w')
        file.write(json.dumps(params['value']))
        file.close()
In [26]:
# functions to convert json to geojson and then to shapefiles 

def post_converttogeojson(requestbody):
    try:
        url = "https://ogre.adc4gis.com/convert"
     
        response = (requests.post(url,files=requestbody).text)
        
        return response

    except Exception as e:
        raise e
def post_converttoshapefile(requestbody):
    try:
        url = "https://ogre.adc4gis.com/convertJson"
     
        response = (requests.post(url,data=requestbody))
        
        z = zipfile.ZipFile(io.BytesIO(response.content))
        z.extractall("./shapefiles/")
        
        time.sleep(0.5)
        return response
    
    except Exception as e:
        raise e
        
requestbody={'upload':open('./jsonfiles/ssurgodata1.json','rb')}


#function call to convert json reponse to geojson
ssurgodata_geojson=post_converttogeojson(requestbody)
requestbody={'json':ssurgodata_geojson,'skipFailures':"on"}


#function call to create shapefiles
post_converttoshapefile(requestbody)
Out[26]:
<Response [200]>
In [27]:
gdf = gpd.read_file('./shapefiles/OGRGeoJSON.shp')

gdf['soilName']=gdf['MUKEY'].map(mukeydict)

gdf.plot(column='soilName', cmap=None,figsize=(10, 10),legend=True) 
gdf.head()
Out[27]:
FID FID_inputS OBJECTID Shape_Leng FID_soilmu AREASYMBOL SPATIALVER MUSYM MUKEY Shape_Area Shape_Le_1 Shape_Ar_1 geometry soilName
0 1 0 1 0 3546 WI047 3 PnB 423737 89316.590000 2718.171958 89316.593877 (POLYGON ((557820.4662999995 2324649.4619, 557... Plano silt loam, till substratum, 2 to 6 perc...
1 2 0 1 0 6625 WI047 3 GrC2 423689 7704.103000 902.542776 7704.103015 (POLYGON ((557464.9373999983 2324628.828299999... Griswold silt loam, 6 to 12 percent slopes, er...
2 3 0 1 0 6644 WI047 3 PnA 423736 5738.143000 312.364678 5738.142598 POLYGON ((557528.9382999986 2324278.0851, 5574... Plano silt loam, till substratum, 0 to 2 perc...
3 4 0 1 0 8519 WI047 3 KeC2 423699 2100.006000 207.168031 2100.006468 POLYGON ((557850.635400001 2324338.1587, 55784... Kidder loam, 6 to 12 percent slopes, eroded
4 5 0 1 0 9703 WI047 3 PnA 423736 47472.360000 1068.944547 47472.363680 POLYGON ((557820.4662999995 2324649.4619, 5578... Plano silt loam, till substratum, 0 to 2 perc...