1

I have a GeoJSON which I'm able to successfully covert to a shapefile via the following process: using arcpy.asShape to find geometry, and inserting this geometry as new fields using cursor insertRow). Here's my code:

jData2 = json.loads(fp.read().decode("utf-8-sig").encode("utf-8"))
for feature in jData['features']:
    #print feature['geometry']['type']
    point = feature["geometry"]
    geom = arcpy.AsShape(point, False)
   # print(geom.type)

  print("geometry read in!")

arcpy.env.workspace = bikeFacilitiesFolder = 'G:\Bike Facilities Data\SF_BikeLanes.gdb'
arcpy.env.overwriteOutput = True

#make new fc
fc = r'G:\Bike Facilities Data\SF_BikeLanes.gdb\geojson_test'
sr = arcpy.SpatialReference(4326) 
path, name = os.path.split(fc)
arcpy.management.CreateFeatureclass(path, name, 'POLYLINE', spatial_reference=sr)
print("fc created!")

# add fields as listed from the properties of each feature
fields = ['street_', 'from_st', 'to_st', 'greenwave']
for field in fields:
    arcpy.management.AddField(fc, field, 'TEXT')
print("fields added!")

# insert rows
with arcpy.da.InsertCursor(fc, ['SHAPE@'] + fields) as irows:
    for feature in jData2['features']:
        geom = arcpy.AsShape(feature['geometry'], False)
        irows.insertRow([geom] + [feature['properties'][f] for f in fields])

For what it's worth, the original GeoJSON looks like this, and there's well over 1000 records:

{ "type": "FeatureCollection", "features": [{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-122.47512772300517,37.807408484936566],[-122.474966524051,37.80752154192644],[-122.47479521215574,37.80761005526742],[-122.47467695769082,37.807639745767275],[-122.47457098118358,37.80763960394547],[-122.47447242920829,37.807612594076865],[-122.47424339925378,37.80746166157941],[-122.47388562809269,37.807129457884606]]},"properties":{"number_":"95","from_st":"UNNAMED 078","contraflow":false,"greenwave":false,"barrier":null,"street_":"Unnamed077","sharrow":"0","cnn":"19789000","surface_tr":null,"globalid":"{1F9327AD-E680-42CD-8548-9D27BC06067F}","direct":"2W","double":"1","facility_t":"CLASS III","symbology":"BIKE ROUTE","fy":"0","sm_sweeper":false,"dir":"S","streetname":null,"buffered":false,"install_yr":null,"raised":false,"install_mo":null,"update_mo":null,"biap":false,"length":"0.09","notes":"PRESIDIO","qtr":"0","to_st":"UNNAMED 052","update_yr":null}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-122.47512772300517,37.807408484936566],[-122.474966524051,37.80752154192644],[-122.47479521215574,37.80761005526742],[-122.47467695769082,37.807639745767275],[-122.47457098118358,37.80763960394547],[-122.47447242920829,37.807612594076865],[-122.47424339925378,37.80746166157941],[-122.47388562809269,37.807129457884606]]},"properties":{"number_":"65","from_st":"UNNAMED 078","contraflow":false,"greenwave":false,"barrier":null,"street_":"Unnamed077","sharrow":"0","cnn":"19789000","surface_tr":null,"globalid":"{0A792A5B-B61F-408C-BD80-14F4CFB44A59}","direct":"2W","double":"0","facility_t":"CLASS III","symbology":"BIKE ROUTE","fy":"0","sm_sweeper":false,"dir":"N","streetname":null,"buffered":false,"install_yr":null,"raised":false,"install_mo":null,"update_mo":null,"biap":false,"length":"0.09","notes":"PRESIDIO","qtr":"0","to_st":"UNNAMED 052","update_yr":null}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-122.47602066615799,37.80689435429642],[-122.47538893345842,37.80633679782139]]},"properties":{"number_":"2","from_st":null,"contraflow":false,"greenwave":false,"barrier":null,"street_":"Hwy 101","sharrow":"0","cnn":"19866002","surface_tr":null,"globalid":"{3B269E34-F62F-4E21-AAA9-C9538221EDD6}","direct":"2W","double":"0","facility_t":"CLASS III","symbology":"BIKE ROUTE","fy":"0","sm_sweeper":false,"dir":"S","streetname":null,"buffered":false,"install_yr":null,"raised":false,"install_mo":null,"update_mo":null,"biap":false,"length":"0.05","notes":"PRESIDIO","qtr":"0","to_st":null,"update_yr":null}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-122.47388562809269,37.807129457884606],[-122.47343461065218,37.80672429719383]]},"properties":{"number_":"95","from_st":"LINCOLN BLVD","contraflow":false,"greenwave":false,"barrier":null,"street_":"Unnamed 077","sharrow":"0","cnn":"19790000","surface_tr":null,"globalid":"{EC671D49-B9DF-4832-86A4-5AAA4346A3A9}","direct":"2W","double":"1","facility_t":"CLASS III","symbology":"BIKE ROUTE","fy":"0","sm_sweeper":false,"dir":"S","streetname":null,"buffered":false,"install_yr":null,"raised":false,"install_mo":null,"update_mo":null,"biap":false,"length":"0.04","notes":"PRESIDIO","qtr":"0","to_st":"UNNAMED 078","update_yr":null}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-122.47388562809269,37.807129457884606],[-122.47343461065218,37.80672429719383]]},"properties":{"number_":"65","from_st":"LINCOLN BLVD","contraflow":false,"greenwave":false,"barrier":null,"street_":"Unnamed077","sharrow":"0","cnn":"19790000","surface_tr":null,"globalid":"{D84DFADC-2269-457F-B0C2-FA1C2C565777}","direct":"2W","double":"0","facility_t":"CLASS III","symbology":"BIKE ROUTE","fy":"0","sm_sweeper":false,"dir":"N","streetname":null,"buffered":false,"install_yr":null,"raised":false,"install_mo":null,"update_mo":null,"biap":false,"length":"0.04","notes":"PRESIDIO","qtr":"0","to_st":"UNNAMED 078","update_yr":null}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-122.47602066615799,37.80689435429642],[-122.47538893345842,37.80633679782139]]},"properties":

This code successfully writes geojson_test and I can open it in ArcMap, but it only has 1000 records. It seems like there's a limit to the amount of rows I can write to a feature class.

Is there a way to get around this, especially, a way that doesn't involve a bunch of added code?

closed as off-topic by Vince, user2856, xunilk, LaughU, Fran Raga Aug 13 at 8:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, user2856, xunilk, LaughU, Fran Raga
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    My personal record is 126 million rows added to a file geodatabase feature class in an InsertCursor stream; there certainly isn't a 1000 row limit, though queries only grab the first thousand at first when reviewing the table contents. – Vince Aug 12 at 21:15
  • What does arcpy.GetCount_management(fc) return? – user2856 Aug 12 at 21:26
  • arcpy.GetCount_management(fc) prints out 1000, so not sure what's up here. Am I for sure using a geodatabase feature class here? It seems as if I am. – DiamondJoe12 Aug 12 at 21:37
  • 1
    Or may be there is some sort of syntax corruption at the 1000 element in your geojson file terminating the insert cursor early? – Hornbydd Aug 12 at 22:24
  • That seems very unlikely. It's almost certainly an issue with not being able to write more than 1000 rows. This problem is documented in the past, though I'm having trouble finding a solution based on past answers: community.esri.com/thread/169204 – DiamondJoe12 Aug 12 at 23:22