Error Saving Feature Set

541
14
01-17-2019 06:43 AM
ThomasTaggart2
New Contributor III

I am trying to convert from a GEOJSON FeatureCollection to an Feature Class, using the Python API. The FeatureCollection contains a single point and a single polygon geometries.  The saving fails.  I suppose because of the mixed geometry?  Here is my code and the error:

geojson_file = r'C:\Users\XXX\Documents\Python_Scripts\SS_160_SnappedLoc_geoms.geojson'
with open(geojson_file) as f:
    geojson = json.load(f)
arc_conv_out = arcgis.features.FeatureSet.from_geojson(geojson)
arc_conv_out.save(r"C:\Users\xxx\Documents\Python_Scripts\SS_160_SnappedLoc_geoms.geojson", "test_out")


ERROR:

AttributeError: module 'arcpy' has no attribute 'JSONToFeatures_conversion'

Anyone have any ideas?

Tags (2)
0 Kudos
14 Replies
JoshuaBixby
MVP Esteemed Contributor

Although you cannot mix geometries in feature classes, your error message is about something else.  What version of ArcPy is installed on this machine and which line specifically is generating the error?

0 Kudos
ThomasTaggart2
New Contributor III

Yes - I was pointing to a virtual environment in PyCharm that was copying over the python environment from my install of ArcGIS Pro.  For some reason, that wasn't recognizing or seeing Arcpy from the ArcGIS Pro install.  SO I pointed it back to my ArcMap python install and it sees it.

Now, it will give me a different error that I will assume might be due to trying to saved the mixed geometry feature set to a feature class.  

Can you suggest how to go about extract and only saving the polygon from the feature set?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Can you post an example of your GeoJSON with the mixed geometries, it is easier to demonstrate with an example, especially one relevant to your issue.

0 Kudos
ThomasTaggart2
New Contributor III
{"crs": {"type": "ESPG", "properties": {"code": 4326}}, "type": "FeatureCollection", "features": [{"properties": {"FID": 0, "OBJECTID": 1, "Descript": "P01080106", "HUCID": "01080106", "DrainID": 2, "Longitude": 0, "HydroID": 1, "Measure": 0, "Latitude": 0, "ReachCode": " ", "Name": "ags101", "SADES_ID": 160}, "type": "Feature", "geometry": {"type": "Point", "coordinates": [-71.9699842506338, 43.654311975352826]}}, {"properties": {"PREG_03_05": 0, "ORIG_FID": 1, "LC11DEV": 0, "RCHRG_SPR": 0, "SNOFALL": 0, "HydroID": 2, "TEMP_06_10": 0, "MINTEMP_W": 0, "Shape_Area": 23837399.6305, "CENTROIDY": 0, "CENTROIDX": 0, "BSLDEM30M": 0, "OUTLETY": 0, "LC11IMP": 0, "RELATEDOID": " ", "CSL10_85": 371.0, "RCHRG_FAL": 0, "DRNAREA": 0.86, "PREBC_1112": 0, "Name": "ags101", "OBJECTID": 1, "PREBC0103": 0, "MIXFOR": 0, "RCHRG_ANN": 0, "Descript": "W01080106", "GlobalWshd": 1, "TEMP": 0, "RCHRG_WIN": 0, "DrainID": 2, "RCHRG_SUM": 0, "CONIF": 0, "FID": 0, "Shape_Leng": 25799.999581, "APRAVPRE": 3.483, "OUTLETX": 0, "PRECIPCENT": 0, "PREG_06_10": 0, "HUCID": "01080106", "ELEVMAX": 0, "PRECIPOUT": 0, "WETLAND": 0.0, "SADES_ID": 160, "Q2": 49.189762696441804, "Q5": 84.73620100258046, "Q10": 115.61310532083027, "Q25": 158.94437570977894, "Q50": 195.27337951678564, "Q100": 238.8380961384394, "Q500": 347.20025971661516}, "type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-71.97037911846795, 43.65394056313409], [-71.9709458777763, 43.65393905593083], [-71.97094629332796, 43.65402135769166], [-71.9710596450912, 43.654021055913624], [-71.97106006079942, 43.6541033576724], [-71.97117341271571, 43.6541030557811], [-71.971173828585, 43.654185358437864], [-71.97230735167823, 43.65418233332786], [-71.97230776909271, 43.65426463507474], [-71.9724211212992, 43.654264331945356], [-71.97242153887025, 43.654346633690196], [-71.97253489246941, 43.65434633044422], [-71.97253531019705, 43.654428632187006], [-71.97264866270957, 43.65442832883108], [-71.97264908059378, 43.6545106305718], [-71.97276243325935, 43.65451032710261], [-71.97276326934723, 43.65467493147879], [-71.97287662232064, 43.654674627895474], [-71.97287745872065, 43.65483923136508], [-71.97299081200187, 43.65483892766764], [-71.97299164871856, 43.655003531130724], [-71.97310500230763, 43.65500322731915], [-71.97310542082802, 43.65508552994813], [-71.97321877580978, 43.65508522601996], [-71.97321961315632, 43.65524982947242], [-71.97333296720626, 43.65524952543344], [-71.97333422370383, 43.65549643060057], [-71.97344757821641, 43.655496126446586], [-71.97344925419517, 43.655825334216], [-71.97356260932521, 43.65582502994615], [-71.97356344763716, 43.65598963427199], [-71.97367680307504, 43.65598932988798], [-71.97367722238619, 43.656071631598216], [-71.9737905792168, 43.65607132709762], [-71.97379183762536, 43.65631823221853], [-71.97390519367895, 43.65631792760625], [-71.9739060329411, 43.65648253191253], [-71.97401938930255, 43.6564822271861], [-71.97402022887687, 43.656646830585835], [-71.97413358554616, 43.65664652574525], [-71.97413484539001, 43.65689343173338], [-71.97424820252199, 43.65689312677778], [-71.97424862262679, 43.65697542847053], [-71.97436197991179, 43.65697512340165], [-71.97436282043638, 43.65713972678186], [-71.97447617926895, 43.65713942159548], [-71.97447659968873, 43.6572217232829], [-71.97458995743465, 43.657221417986584], [-71.97459037801103, 43.65730371967195], [-71.97470373590998, 43.65730341426237], [-71.97470415664759, 43.657385716845724], [-71.97481751469957, 43.65738541132288], [-71.97481793558917, 43.65746771300412], [-71.9749312937942, 43.657467407367974], [-71.97493213588838, 43.65763201072514], [-71.975045495641, 43.657631704971465], [-71.97504591684559, 43.65771400664738], [-71.97515927551153, 43.65771370078379], [-71.97516053960511, 43.657960606701806], [-71.97527389873376, 43.65796030072318], [-71.97527642789352, 43.65845411162171], [-71.97538978794934, 43.65845380552542], [-71.9753918964065, 43.65886531472038], [-71.97550525723474, 43.6588650085073], [-71.97550567908544, 43.65894731016183], [-71.9759591242395, 43.658946084178595], [-71.97595954671132, 43.6590283858284], [-71.9761862689674, 43.6590277721622], [-71.97618669175068, 43.6591100738091], [-71.97630005427064, 43.659109766803134], [-71.97630047721519, 43.65919206934801], [-71.97641383864841, 43.659191762232126], [-71.97641426174499, 43.65927406387486], [-71.97652762333128, 43.659273756645696], [-71.97652804658448, 43.65935605828635], [-71.9766414083238, 43.659355750943874], [-71.9766426785633, 43.659602656756164], [-71.97675604076535, 43.65960234929863], [-71.9767564643354, 43.65968465093277], [-71.9768698266905, 43.659684343361945], [-71.97687025041718, 43.659766644994015], [-71.97698361416508, 43.659766337306536], [-71.97698403804841, 43.65984863893654], [-71.97709740070961, 43.65984833113912], [-71.97709782474955, 43.659930632767065], [-71.9772111875638, 43.659930324856354], [-71.97721161176503, 43.66001262738227], [-71.97732497473233, 43.66001231935825], [-71.97732539908556, 43.66009462098203], [-71.97743876220589, 43.66009431284473], [-71.97743918671578, 43.660176614466415], [-71.97755255122892, 43.66017630621245], [-71.97755297589545, 43.66025860783207], [-71.97766633932186, 43.66025829946816], [-71.97766676414506, 43.66034060108573], [-71.97778012772453, 43.660340292608524], [-71.97778055270435, 43.66042259422401], [-71.97789391643687, 43.660422285633494], [-71.97789434157798, 43.66050458814699], [-71.97800770546355, 43.66050427944316], [-71.97800813075669, 43.66058658105451], [-71.97834822410688, 43.66058565426253], [-71.97834864986636, 43.66066795587002], [-71.97846201405439, 43.660667646714764], [-71.97846243997051, 43.66074994832019], [-71.97857580431159, 43.66074963905162], [-71.97857665646363, 43.66091424315717], [-71.97869002111263, 43.66091393377441], [-71.97869215228688, 43.661325441762855], [-71.9788055189481, 43.66132513225987], [-71.9788059453479, 43.66140743475315], [-71.9789193109224, 43.66140712514025], [-71.9789197374742, 43.66148942673139], [-71.97903310320173, 43.661489117005175], [-71.97903352991018, 43.66157141859424], [-71.97914689579076, 43.661571108754735], [-71.9791473226559, 43.66165341034173], [-71.97926068868954, 43.6616531003889], [-71.97926111571131, 43.66173540197379], [-71.9793744831378, 43.66173509190427], [-71.97937491032091, 43.661817394387164], [-71.97948827666066, 43.661817084207726], [-71.97948870399578, 43.661899385788445], [-71.97960207048857, 43.66189907549568], [-71.97960249798035, 43.661981377074355], [-71.97971586462619, 43.66198106666829], [-71.97971629227465, 43.66206336824489], [-71.97982965907352, 43.66206305772549], [-71.97983008687865, 43.662145359300006], [-71.97994345383057, 43.6621450486673], [-71.9799438817924, 43.66222735023975], [-71.98005725013716, 43.662227039490325], [-71.98005767826031, 43.66230934196073], [-71.98017104551833, 43.66230903110141], [-71.98017147379349, 43.66239133266968], [-71.98028484120456, 43.66239102169702], [-71.9802852696364, 43.662473323263235], [-71.98039863720052, 43.66247301217726], [-71.98039906578903, 43.662555313741386], [-71.98051243350622, 43.66255500254207], [-71.98051286225142, 43.66263730410409], [-71.98062623136141, 43.66263699278808], [-71.980626660268, 43.662719295248095], [-71.98074002829127, 43.66271898382218], [-71.98074045734984, 43.662801285380056], [-71.98085382552613, 43.66280097384081], [-71.98085468395846, 43.66296557695117], [-71.98096805244266, 43.66296526529772], [-71.98097191688132, 43.66370598102742], [-71.98108528675755, 43.663705669253524], [-71.98108571630256, 43.6637879707944], [-71.98119908633186, 43.66378765890718], [-71.98119951603354, 43.66386996044597], [-71.98131288745572, 43.66386964844201], [-71.9813133173141, 43.66395194997874], [-71.9814266876495, 43.66395163786486], [-71.9814271176646, 43.66403393939948], [-71.98154048815303, 43.66403362717228], [-71.98154091832953, 43.6641159296049], [-71.98165428897104, 43.66411561726437], [-71.98165471929951, 43.664197918794834], [-71.98176809009408, 43.66419760634098], [-71.98176852057925, 43.66427990786935], [-71.98154177867858, 43.6642805326664], [-71.98154220885581, 43.664362834195366], [-71.9813154666381, 43.664363458544436], [-71.98131589650741, 43.66444576007396], [-71.98108915273278, 43.6644463839785], [-71.98108958229886, 43.664528686408715], [-71.98097621087386, 43.664528998191514], [-71.9809766402822, 43.664611299721344], [-71.98074989711695, 43.6646119229514], [-71.98075032621735, 43.664694224481856], [-71.98063695447712, 43.66469453592913], [-71.98063738342442, 43.66477683745924], [-71.98052401028767, 43.66477714879836], [-71.98052443908192, 43.66485945032818], [-71.98041106702829, 43.664859761552364], [-71.98041235296199, 43.66510666703739], [-71.9802989804419, 43.66510697815178], [-71.98029940893367, 43.66518927967861], [-71.98018603625687, 43.665189590681464], [-71.98018646459555, 43.66527189220797], [-71.98007309176205, 43.66527220309928], [-71.98007351994767, 43.6653545046255], [-71.97996014571763, 43.66535481540864], [-71.97996057375485, 43.66543711783463], [-71.97984720060796, 43.66543742850281], [-71.97984762848742, 43.66551973002841], [-71.97973425518386, 43.66552004058506], [-71.97973468291022, 43.66560234211035], [-71.97962130944994, 43.665602652555464], [-71.97962173702325, 43.66568495408045], [-71.97950836340625, 43.66568526441399], [-71.9795087908265, 43.66576756593866], [-71.97928204203743, 43.66576818627358], [-71.9792824691497, 43.66585048779888], [-71.9791690952175, 43.66585079779686], [-71.97916952218135, 43.66593310022188], [-71.97905614809245, 43.66593341010833], [-71.97905657489856, 43.66601571163295], [-71.97894320065296, 43.666016021407856], [-71.97894362730597, 43.66609832293219], [-71.97883025290366, 43.6660986325955], [-71.97883067940361, 43.66618093411953], [-71.97871730360472, 43.66618124367469], [-71.97871772995158, 43.66626354519839], [-71.97860435523586, 43.666263854638615], [-71.97860478143429, 43.66634615706209], [-71.9784914065619, 43.66634646639072], [-71.97849183260257, 43.66642876791383], [-71.97837845757347, 43.66642907713092], [-71.97837888346105, 43.666511378653716], [-71.97826550827524, 43.66651168775925], [-71.97826593400974, 43.66659398928173], [-71.97815255866723, 43.66659429827569], [-71.97815298424864, 43.66667659979788], [-71.97803960750954, 43.666676908683634], [-71.97804003294249, 43.66675921110556], [-71.97792665728659, 43.6667595198764], [-71.9779270825618, 43.66684182139796], [-71.97667994604443, 43.666845210472275], [-71.97668036961754, 43.66692751200231], [-71.9764536176412, 43.666928126736394], [-71.97645404090629, 43.66701042826699], [-71.97611391122372, 43.66701134953076], [-71.97611433402592, 43.66709365106279], [-71.97600095771992, 43.66709395792557], [-71.97600138036901, 43.66717625945731], [-71.97588800390628, 43.66717656620853], [-71.9758884264069, 43.66725886864002], [-71.97577504978746, 43.66725917527965], [-71.97577547213032, 43.66734147681072], [-71.97566209411431, 43.667341783342145], [-71.97566251630407, 43.66742408487293], [-71.97554913937127, 43.66742439128942], [-71.9755495614079, 43.667506692819885], [-71.97543618431841, 43.66750699912482], [-71.97543660620194, 43.66758930065495], [-71.97532322895574, 43.66758960684832], [-71.97532365069078, 43.6676719092782], [-71.97521027328789, 43.66767221535997], [-71.97521069486517, 43.667754516889495], [-71.9750973173056, 43.667754822859706], [-71.97509773872977, 43.66783712438888], [-71.9749843597736, 43.667837430250856], [-71.97498478104465, 43.667919731779726], [-71.97487140317169, 43.66792003752677], [-71.97487182428964, 43.66800233905532], [-71.97475844625998, 43.66800264469082], [-71.97475886722479, 43.66808494621902], [-71.97464548903845, 43.66808525174293], [-71.97464590985473, 43.668167554170886], [-71.97453253151168, 43.66816785958323], [-71.97453295217025, 43.66825016111081], [-71.9744195724306, 43.668250466414904], [-71.97441999293603, 43.66833276794216], [-71.97430661427961, 43.668333073131315], [-71.97430703463189, 43.668415374658274], [-71.9741936558188, 43.668415679735865], [-71.97419407601797, 43.66849798126247], [-71.97408069704818, 43.66849828622848], [-71.97408111709879, 43.66858058865484], [-71.97396773797227, 43.668580893509265], [-71.9739681578652, 43.66866319503525], [-71.973854778582, 43.66866349977809], [-71.97385519832179, 43.66874580130375], [-71.97374181764194, 43.66874610593835], [-71.97374223722859, 43.66882840746368], [-71.97362885763204, 43.66882871198335], [-71.97362927706554, 43.66891101350838], [-71.97351589731227, 43.66891131791648], [-71.97351631659264, 43.668993619441174], [-71.97340293668266, 43.6689939237377], [-71.97340335581447, 43.66907622616212], [-71.97328997574782, 43.669076530347034], [-71.9732903947219, 43.669158831871044], [-71.97317701325862, 43.66915913594774], [-71.97317743207957, 43.66924143747147], [-71.9730640516995, 43.669241741433204], [-71.9730644703673, 43.669324042956596], [-71.97295108983059, 43.66932434680676], [-71.97295150834523, 43.669406648329826], [-71.97283812765181, 43.669406952068435], [-71.97283854601791, 43.66948925449123], [-71.97272516516779, 43.66948955811822], [-71.97272558337615, 43.66957185964065], [-71.97261220236935, 43.66957216315605], [-71.97261262042456, 43.66965446467813], [-71.97249923802109, 43.66965476808528], [-71.97249965592316, 43.669737069607045], [-71.97238627460297, 43.66973737289926], [-71.97238669235188, 43.66981967442072], [-71.972273310875, 43.66981997760134], [-71.97227372847074, 43.66990227912245], [-71.97216034683717, 43.6699025821915], [-71.97216076428434, 43.669984884612354], [-71.97204738249408, 43.6699851875698], [-71.97204779978351, 43.67006748909024], [-71.9719344165966, 43.67006779193942], [-71.9719348337329, 43.67015009345954], [-71.97182145162922, 43.67015039619382], [-71.97182186861235, 43.67023269771363], [-71.97170848635201, 43.670233000336296], [-71.97170973685179, 43.67047990579118], [-71.97182311957694, 43.67047960316591], [-71.97182478754834, 43.67080880921887], [-71.97193817089142, 43.67080850647768], [-71.97193942235789, 43.67105541190233], [-71.97205280740397, 43.67105510904278], [-71.97205364203062, 43.67121971205148], [-71.96559073097832, 43.67123679550192], [-71.96559032249533, 43.67115449394936], [-71.96547693843458, 43.67115479039612], [-71.96547653010826, 43.67107248884153], [-71.9653631462007, 43.67107278517497], [-71.96536273803106, 43.67099048361835], [-71.96524935427672, 43.67099077983849], [-71.96524894626371, 43.670908478279834], [-71.9651355614226, 43.670908774389886], [-71.96513515356177, 43.67082647192912], [-71.96502177011385, 43.670826767922655], [-71.96502136241418, 43.67074446635989], [-71.96490797911943, 43.67074476224011], [-71.96490757157643, 43.67066246067532], [-71.96445403775995, 43.67066364307145], [-71.96445363083836, 43.67058134150211], [-71.96434024784486, 43.67058163681834], [-71.96433984107993, 43.670499335246944], [-71.96422645823964, 43.67049963044986], [-71.96422605163136, 43.670417328876425], [-71.96411266894427, 43.67041762396607], [-71.9641122624882, 43.67033532149054], [-71.96399887995432, 43.67033561646687], [-71.96399847365933, 43.670253314889344], [-71.96388509003869, 43.670253609755605], [-71.96388468390036, 43.67017130817606], [-71.96377130167288, 43.67017160292577], [-71.9637708956912, 43.6700893013442], [-71.96161663226664, 43.67009488021548], [-71.96161703530473, 43.67017718181298], [-71.95946276708004, 43.67018272010571], [-71.95946316717627, 43.670265021717846], [-71.95832934136995, 43.67026792030699], [-71.95832894282302, 43.67018561868657], [-71.95821555927203, 43.67018590792895], [-71.95821476249309, 43.67002130468289], [-71.9583281457342, 43.67002101544214], [-71.9583273486478, 43.66985641129291], [-71.95844073033743, 43.669856121944505], [-71.95843993295229, 43.66969151869218], [-71.95855331433037, 43.66969122923298], [-71.95855251664216, 43.66952662597757], [-71.9584391355739, 43.66952691543513], [-71.95843674347061, 43.669033103835126], [-71.95855012360933, 43.66903281438257], [-71.9585497247779, 43.6689505127459], [-71.95866310476002, 43.66895022318169], [-71.95866270577535, 43.668867921544674], [-71.95877608560085, 43.668867631868835], [-71.95877568646296, 43.66878533023146], [-71.95888906613189, 43.66878504044398], [-71.95888866684076, 43.66870273880622], [-71.95900204759302, 43.66870244890397], [-71.95900164814869, 43.668620147265855], [-71.95911502750437, 43.66861985725514], [-71.95911302952918, 43.668208348150756], [-71.95922640810862, 43.66820805803172], [-71.95922281046491, 43.66746734139616], [-71.95933618764849, 43.667467051172146], [-71.95933498799823, 43.66722014530796], [-71.9594483647154, 43.66721985497399], [-71.95944756465016, 43.66705525166025], [-71.95956094229572, 43.66705496121233], [-71.95955934156159, 43.66672575367384], [-71.95967271734597, 43.66672546311996], [-71.95967151635176, 43.666478558131075], [-71.95978489166976, 43.66647826746724], [-71.95978369022174, 43.66623136157009], [-71.95989706507335, 43.66623107079627], [-71.95989466129818, 43.665737259874774], [-71.95978128737595, 43.665737550643605], [-71.95978088690832, 43.66565524896834], [-71.95966751313925, 43.66565553962388], [-71.9596671128282, 43.66557323794662], [-71.95955373921234, 43.6655735284889], [-71.95955293890073, 43.66540892422907], [-71.95943956435309, 43.66540921466039], [-71.95943396455203, 43.664256989196716], [-71.9595473369313, 43.664256698776995], [-71.95954613655, 43.66400979277824], [-71.95965950722307, 43.66400950225174], [-71.95965830639682, 43.6637625971448], [-71.95977167660355, 43.66376230650836], [-71.95977127617664, 43.663680004804526], [-71.95988464622684, 43.66367971405647], [-71.95988424564239, 43.66359741145217], [-71.95999761553598, 43.66359712059253], [-71.9599960126131, 43.66326791376701], [-71.95988264333901, 43.66326820462333], [-71.95988184219313, 43.66310360030172], [-71.95976847322704, 43.663103891043946], [-71.9597652699635, 43.662445476403256], [-71.95987863769064, 43.662445185667664], [-71.959878237136, 43.662362883945534], [-71.9599916047066, 43.66236259309835], [-71.95999040258393, 43.662115687027274], [-71.96010376968822, 43.66211539607017], [-71.96010216626378, 43.66178618826205], [-71.96021553398674, 43.66178589719265], [-71.9602119249929, 43.66104518068717], [-71.96032529008066, 43.661044889516006], [-71.96032288323063, 43.660551078163685], [-71.96043624738758, 43.66055078688509], [-71.96043544480524, 43.66038618249304], [-71.96054880865078, 43.660385891103694], [-71.9605484072095, 43.660303589356765], [-71.9606617708985, 43.66030329785583], [-71.96066136930408, 43.660220996108514], [-71.96077473407628, 43.660220704492815], [-71.9607743323287, 43.660138402745154], [-71.96088769570461, 43.66013811102104], [-71.96088729380389, 43.66005580927303], [-71.96100065702325, 43.66005551743736], [-71.96100025496499, 43.6599732147889], [-71.96111361802781, 43.65997292284162], [-71.9611132158208, 43.659890621092885], [-71.96122657872705, 43.659890329034035], [-71.9612261763669, 43.659808027284924], [-71.96133953911664, 43.65980773511448], [-71.96133913660336, 43.659725433365026], [-71.96145250043627, 43.6597251410798], [-71.96145209776985, 43.65964283932999], [-71.96156546020644, 43.659642546936375], [-71.96156465456467, 43.6594779425348], [-71.96167801668987, 43.659477650030425], [-71.9616776137189, 43.659395348278714], [-71.96179097568758, 43.659395055662785], [-71.96179057256347, 43.6593127539107], [-71.9619039343756, 43.65931246118319], [-71.96190353109837, 43.659230159430756], [-71.96201689399368, 43.65922986658844], [-71.96201649055891, 43.65914756393559], [-71.96212985205794, 43.6591472709849], [-71.96212944847443, 43.65906496923176], [-71.96224280981691, 43.659064676169514], [-71.96224240608029, 43.65898237441602], [-71.96235576726622, 43.658982081242186], [-71.96235536337649, 43.658899779488344], [-71.96246872440585, 43.658899486202934], [-71.96246832036299, 43.65881718444872], [-71.9625816812358, 43.65881689105173], [-71.96258127703983, 43.65873458929717], [-71.96269463899584, 43.6587342957854], [-71.9626942346423, 43.658651993130405], [-71.96280759520205, 43.65865169951025], [-71.96280719069982, 43.658569397754995], [-71.962920551103, 43.65856910402328], [-71.96292014644764, 43.65848680226765], [-71.9630335066943, 43.65848650842436], [-71.96303310188583, 43.658404206668386], [-71.96314646197594, 43.65840391271353], [-71.96314605701434, 43.65832161095721], [-71.9632594181876, 43.658321316887566], [-71.96325901306848, 43.65823901423081], [-71.96337237284547, 43.658238720052786], [-71.96337196757766, 43.65815641829577], [-71.96348532719811, 43.65815612400619], [-71.96348492177718, 43.65807382224879], [-71.96359828124109, 43.658073527847634], [-71.96359787566706, 43.65799122608991], [-71.9637112349744, 43.657990931577196], [-71.96371082924723, 43.65790862981912], [-71.96382418839806, 43.65790833519482], [-71.9638237825178, 43.657826033436386], [-71.96393714275177, 43.657825738697284], [-71.96393673671398, 43.657743436038466], [-71.9640500955517, 43.65774314119102], [-71.96404968936523, 43.657660839431884], [-71.9641630480464, 43.65766054447289], [-71.9641626417068, 43.657578242713406], [-71.96427600023144, 43.657577947642835], [-71.96427559373876, 43.657495645883], [-71.96438895210683, 43.65749535070088], [-71.96438854546105, 43.65741304894067], [-71.96495533774116, 43.65741157134493], [-71.96495493031853, 43.65732926868768], [-71.96506828836661, 43.65732897283279], [-71.96506788079533, 43.65724667107528], [-71.96518123992657, 43.65724637510559], [-71.9651808322022, 43.65716407334774], [-71.96529418993717, 43.657163777269744], [-71.9652937820597, 43.657081475511525], [-71.96540713963813, 43.65708117932196], [-71.96540673160757, 43.6569988775634], [-71.96552008902947, 43.65699858126228], [-71.96551968084582, 43.65691627950337], [-71.96563303811115, 43.656915983090684], [-71.96563262976993, 43.65683368043136], [-71.96574598811841, 43.65683338390386], [-71.96574557962856, 43.65675108214427], [-71.9658589365808, 43.65675078550846], [-71.96585852793788, 43.656668483748504], [-71.96597188473358, 43.656668187001145], [-71.96597147593756, 43.656585885240865], [-71.96608483257668, 43.65658558838195], [-71.9660844236276, 43.65650328662131], [-71.96619778011019, 43.65650298965081], [-71.96619737100355, 43.65642068698978], [-71.96631072732959, 43.65642038990776], [-71.9663103180743, 43.65633808814642], [-71.96676374398153, 43.65633689869436], [-71.96676333410875, 43.65625459693524], [-71.96710340336641, 43.65625370366766], [-71.9671029930309, 43.65617140190992], [-71.96721634887861, 43.656171103931186], [-71.96721593839005, 43.6560888021731], [-71.9673292940812, 43.65608850408281], [-71.96732888343956, 43.65600620232438], [-71.967555594507, 43.65600560580831], [-71.96755518355299, 43.65592330315036], [-71.96766854016894, 43.65592300472129], [-71.96766812906635, 43.65584070296305], [-71.96778148428609, 43.6558404044257], [-71.96778107303044, 43.6557581026671], [-71.96789442809366, 43.655757804018194], [-71.96789401668491, 43.655675502259264], [-71.96800737159154, 43.655675203498845], [-71.96800696002975, 43.65559290173957], [-71.96812031477984, 43.65559260286757], [-71.96811990306047, 43.65551030020788], [-71.96823325889366, 43.655510001221074], [-71.96823284702573, 43.65542769946113], [-71.96834620146272, 43.655427400366044], [-71.96834578944171, 43.65534509860576], [-71.96845914372216, 43.65534479939915], [-71.9684587315481, 43.65526249763852], [-71.96857208567197, 43.655262198320344], [-71.96857167334487, 43.655179896559375], [-71.96868502731216, 43.65517959712966], [-71.968684614832, 43.65509729536835], [-71.96879796988243, 43.65509699582381], [-71.96879755724467, 43.655014693162094], [-71.96891091089888, 43.6550143935093], [-71.9689104981126, 43.65493209174731], [-71.96902385161026, 43.65493179198295], [-71.96902343867092, 43.654849490220656], [-71.96913679201202, 43.654849190344756], [-71.96913637891964, 43.65476688858209], [-71.9692497321042, 43.654766588594676], [-71.96924931885876, 43.65468428683167], [-71.96958937917715, 43.654683386194314], [-71.96958896546452, 43.654601083532626], [-71.96970231833247, 43.65460078309732], [-71.96970190447132, 43.65451848133538], [-71.96981525718272, 43.65451818078855], [-71.9698148431685, 43.654435879026266], [-71.96992819572333, 43.654435578367895], [-71.96992736739061, 43.65427097484146], [-71.97004072087373, 43.6542706740691], [-71.97004030655519, 43.654188372304965], [-71.97015365864213, 43.65418807142437], [-71.97015324416601, 43.654105768759855], [-71.9702665960964, 43.65410546776771], [-71.97026618147179, 43.654023166002915], [-71.9703795332456, 43.65402286489924], [-71.97037911846795, 43.65394056313409]]]}}]}
0 Kudos
ThomasTaggart2
New Contributor III

Joshua, Your position is interesting, as this data comes form StreamStats (I know, USGS not USDA-FS) - but is slightly manipulated by myself as the raw geojson format received from them isn't perfect and isn't recognized by several programs as geojson.  Anyway...that was just an aside.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

You should bring it up to USGS, but you might want to wait until the partial government shutdown is over.  : )

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I stripped down your GeoJSON for display purposes, but the overall structure is the same.  The following code will remove all features that are not polygons from a Python dictionary created from a GeoJSON string:

geojson = {
    "crs": {"type": "ESPG", "properties": {"code": 4326}},
    "type": "FeatureCollection",
    "features": [
        {
            "properties": {"FID": 0, "OBJECTID": 1},
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [-71.9699842506338, 43.654311975352826]
            }
        },
        {
            "properties": {"FID": 0, "OBJECTID": 1},
            "type": "Feature",
            "geometry": {
                "type": "Polygon",
                "coordinates": [[
                    [-71.97037911846795, 43.65394056313409],
                    [-71.9709458777763, 43.65393905593083],
                    [-71.97094629332796, 43.65402135769166],
                    [-71.9710596450912, 43.654021055913624],
                    [-71.97106006079942, 43.6541033576724]
                ]]
            }
        }
    ]
}

geojson["features"] = [
    feat for feat
    in geojson["features"] 
    if feat["geometry"]["type"] == "Polygon"
]
0 Kudos
ThomasTaggart2
New Contributor III

Thanks Joshua!!

That's helpful to know, but that doesn't really address my bigger question - which is how do I convert this to a feature class to finally store in a GDB.

I keep struggling to get ArcPy to convert this (arcpy.JSONToFeatures_conversion() fails in my 2.7 environment, and the ArcGIS python API doesn't work in that environment at all) and I can't get it to work in the 3.5 ArcPy or ArcGIS python API environments either.

Can you get that stripped down version to successfully load into one of ESRI's toolsets and then save it as a feature class?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I ran my stripped down sample through GeoJSONLint - Validate your GeoJSON .  First, I didn't close the ring properly, but I wasn't interested in making valid GeoJSON to demonstrate the technique for removing non-polygon features.  After closing the polygon ring, GeoJSONLint points out that the ring order is incorrect, so that might be cause the issue.  Also, the latest GeoJSON standard only supports EPSG:4326, so you should just drop the spatial reference.

I will take a closer look at the GeoJSON and Esri's tools a bit later today or tomorrow.