POST
|
We are converting 100's of dwgs in batch using "Feature Class to Feature Class" option through python code. Following is the code we are using try: arcpy.conversion.FeatureClassToFeatureClass(src_dwg, gdb_name, fc_name) print (src_dwg) except Exception: e = sys.exc_info()[1] print(e.args[0]) src_dwg i.e. dwg file name will be like this W:\\002-PLANNING\\YEAR-2014\\17041.dwg\\Polygon W:\\002-PLANNING\\YEAR-2014\\17110.dwg\\Polygon The problem is, at times ArcGIS Pro is not reading a particular set of dwg files. It is reading those dwgs as empty file. Instead of processing the next file (try - except code should work here) ArcGIS Pro process the code and abruptly ends without throwing any error. For eg, if 17110.dwg is being read as empty file ArcGIS Pro is not taking the next file in the list. Instead, code ends at 17110.dwg. Then we have to manually remove the file 17110.dwg from the input list and have to run the code. Again if another similar dwg file is encountered, the code stops. Even when i manually try to convert the dwg using Feature Class to Feature Class tool, it's showing as empty dwg and at times it crashes the ArcGIS Pro.
... View more
11-06-2019
08:37 PM
|
0
|
1
|
389
|
POST
|
We have to QAQC 100's of feature_classes and one of the checks is to check the metadata description. So we are trying to extract Abstract, Title, Extent, Lineage Statement of the feature_classes and save it as a csv file, so that we can easily check the things using filter options in the csv(excel) sheet. Using the ARCGIS2FGDC.xml tranlstor, we can't able to extract "Lineage -> Statement". But ISO19139.xml is doing the job. The problem is, the code i've mentioned in the question doesn;t extract any of the details. All we are getting is a empty csv file. Output text should be like (w.r.t the image attached): 250K Spot height, Bolivia Borax Geographic rtzbolnew (SPOT39P), Extent details, Migrated from ________________ (Lineage Statement)
... View more
01-09-2017
12:50 AM
|
0
|
2
|
1568
|
POST
|
We are trying to extract the feature_classes metadata and save it as csv. With the help of this code we are extracting Abstract, Title, Purpose, Spatial Ref, Extent without any hiccups. But in addition to that we need "Lineage" info and i don't see any lineage info in xml files converted using "ARCGIS2FGDC.xml" translator. But lineage details are getting exported when ARCGIS2ISO19139.xml translator is used. The problem is, i couldn't able to extract any of the details (Abstract, Lineage, Title etc..) from the output xml translated using ARCGIS2ISO19139.xml. This is the code i am using import os
import arcpy
import csv
from xml.etree.ElementTree import ElementTree
from arcpy import env
arcpy.env.overwriteOutput = True
def inventory_data(workspace, datatypes):
for path, path_names, data_names in arcpy.da.Walk(
workspace, datatype=datatypes):
for data_name in data_names:
yield os.path.join(path, data_name)
AGSHOME = arcpy.GetInstallInfo("Desktop")["InstallDir"]
translatorpath = AGSHOME + "Metadata\\Translator\\ARCGIS2ISO19139.xml"
#These two variables need to be updated each time this script is run on a new workspace
outfile = r"D:\QAQC\Metadata\GIS_Data_Inventory.csv"
xmlfile = r"D:\QAQC\Metadata\GIS_Data_Inventory.xml"
with open (outfile, 'wb') as csvfile:
csvwriter = csv.writer(csvfile)
#You need to update workspace in the line below
for feature_class in inventory_data(r"D:\QAQC\Metadata\Test", "FeatureClass"):
try:
desc = arcpy.Describe(feature_class)
sr = desc.spatialReference
arcpy.ExportMetadata_conversion(feature_class, translatorpath, xmlfile)
tree = ElementTree()
tree.parse(xmlfile)
try:
title = tree.find ("identificationInfo/MD_DataIdentification/citation/CI_Citation/title").text
except:
title = "No Title"
try:
abstract = tree.find ("identificationInfo/MD_DataIdentification/abstract").text
except:
abstract = "No Abstract"
try:
lineage = tree.find ("dataQualityInfo/DQ_DataQuality/lineage/LI_Lineage/statement").text
except:
lineage = "No Lineage"
csvwriter.writerow([desc.path.encode('utf-8'), desc.file.encode('utf-8'), desc.dataType.encode('utf-8'), sr.name.encode('utf-8'), purpose.encode('utf-8'), title.encode('utf-8'), abstract.encode('utf-8')])
except Exception:
e = sys.exc_info()[1]
print(e.args[0]) All i am getting in the output csv is "No Title, No Abstract, No Lineage". But the output xml file has these parameters (image attached below).
... View more
01-05-2017
07:03 PM
|
2
|
8
|
4477
|
POST
|
If you want to filter a feature layer in your map to show only a subset of the features it contains then you can set a definition query on that layer. Use IFeatureLayerDefinition.DefinitionExpression to set the query. Thanks a lot for your timely reply. It works fine for the features within the same shapefile. What i like to do is........... Select "Point features which has certain id" from "polygon features which has certain id" Ex: Select point features of "Type = school" from polygon features(which will be in a polygon shapefile) of id "Zone = Z1"
... View more
04-25-2013
11:10 PM
|
0
|
0
|
233
|
POST
|
I have a point & polygon shapefile. Point file has a field namely, Type: atm,hospital,school etc... Polygon file has a field Zone: Zn1, Zn2, Zn3. There will be two combo boxes which will populate this two fields respectively (Fig) [ATTACH=CONFIG]23756[/ATTACH] What i like to do is.......If i select school & Zn2 in the comboboxes and click the "Show" button...... only schools which fall under the Zn2 polygon should be displayed. I m a newbie to both arcobjects & to this forum. Any sort of comment will be of a great help. Trying it for the past two days (ArcGIS Version 9.3.1, VBA )
... View more
04-25-2013
02:08 AM
|
0
|
2
|
528
|
Title | Kudos | Posted |
---|---|---|
2 | 01-05-2017 07:03 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|