![]() ![]() 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: # default is all TEXT fields but I could change this later to reference the values 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 ![]() Import the KMZ, and click Export to convert it to a shapefile. Pop_array = pop_string.split("" in tag and "/td>" not in tag:Īrcpy.DeleteField_management(FC,fields.name) 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. # 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 Using the KML to Layer tool, select the KML layer from your Contents menu and drag it into the Input KML File parameter on the tool. To perform geoprocessing operations on a KML layer, they need to be converted to features inside a file geodatabase. This time, use all the odd index values to update rows ( if i%2 0: row = list ) and then cursor.updateRow(row) The ArcGIS Pro 1.3 release introduces native support for KML and KMZ as data sources. da.UpdateCursor to get PopupInfo's for all rows, then split and create new lists just like with search cursor Loop through field names list with arcpy.AddField_management to add all fields (skip if they already exist) 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. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |