Pop_array = pop_string.split("" in segment and "/td>" not in segment:įields_array=fields_array. Names_array.append("PopupInfo") with arcpy.da.UpdateCursor(FC,names_array) as UC: Learn more about KML support in ArcGIS Usage This tool creates a file geodatabase containing a feature class within a feature dataset. The layer file maintains the symbology found within the original KML or KMZ file. # default is all TEXT fields but I could change this later to reference the values ArcGIS Pro 3.0 Other versions Help archive Summary Converts a KML or KMZ file into feature classes and a layer file. If x%2 = 0 and fields_array not in keep_fields:Īrcpy.AddField_management(FC, fields_array, "TEXT") #even indexes are field names (starts at 0)ĭel fields_array for x in range(0,len(fields_array)):įields_array=fields_array.replace("td>","") #this will list the field names and field values Pop_array = pop_string.split("" in tag and "/td>" not in tag:Īrcpy.DeleteField_management(FC,fields.name) # first add the fields SC = arcpy.SearchCursor(FC) Keep_fields = įor FC in UTM_List: update_layer = (database + '\\' + FC) #in stand-alone script use arcpy.SpatialReferece('desired Coord Sys name')įor FC in GCS_List: arcpy.Project_management(FC, database + '\\' + FC + '_Proj', coord_sys) #alternatively use input_parameter = 'C.\file.kmz' to run as stand alone scriptĭirect = os.path.dirname(input_parameter)Ī(input_parameter, direct) ![]() Input_parameter = arcpy.GetParameterAsText(0) #this line is for using a script tool in arcmap ![]() This time, use all the odd index values to update rows ( if i%2 0: row = list ) and then cursor.updateRow(row) da.UpdateCursor to get PopupInfo's for all rows, then split and create new lists just like with search cursor Import the KMZ, and click Export to convert it to a shapefile. Loop through field names list with arcpy.AddField_management to add all fields (skip if they already exist) After you’ve done this once in ExpertGPS, you’ll have the coordinate format already set to match your ArcGIS project, so converting additional KMZ and KML files simply becomes a two-step process. Then split it into a list based on '' tag but not the 'td>' closing tag into a new list of field names (even indexes) and field values (odd indexes) ![]() da.SearchCursor to get the PopupInfo string from the first row. Use the arcpy KML to layer tool and Project tools to get into to the desired coordinate system (i ran into problems adding fields to the original conversion output, which may be due to the layer file associated with it) Here is a script that does this in python.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |