Determine the number of fields of a certain field type there are in an input feature

المشرف العام

Administrator
طاقم الإدارة
So I am wondering how to get the number of field types "String" by creating a custom function and I can not seem to get it right? Can anybody point me in the right direction? I have a shapefile named streets and there are 73 field names/ field types and I keep getting that number and not the corresponding number for only type "String". Thank you

import arcpyarcpy.env.workspace = "C:\Users\Ogi\Desktop\GIS Programming\Data\PrgGIS\Lab10"

def countstringfields(table): fields = arcpy.ListFields("streets.shp", {"String"}) namelist = [] for field in fields: namelist.append(field.type) return len(namelist)

fieldtype = countstringfields("C:\Users\Ogi\Desktop\GIS Programming\Data\PrgGIS\Lab10\streets.shp")print fieldtype



أكثر...
 
أعلى