New answers tagged python27
1
Arcpy.da.SearchCursor accepts, "feature class, layer, table, or table view" as the in_table. After looking at the Parcel Fabric page, I would suggest Make Parcel Fabric Table View (Parcel Fabric). This will give you a temporary table to use with the cursor.
1
@NathanW's suggestion works for me and is what I would suggest doing as well.
I have in the Install folder within my Python Add-in directory:
child.py:
import os, datetime
def writeDummyFile(path):
with open(path, "w") as f:
f.write(datetime.datetime.now().ctime())
if __name__ == "__main__":
writeDummyFile(r"C:\temp\test.txt")
...
0
you may want to change
os.system('C:/temp/child.py')
to
os.startfile('C:/temp/child.py')
this should run the script.
2
You need
layer.setCustomProperty("labeling/isExpression", True)
and you can use the expression in the string:
layer.setCustomProperty("labeling/fieldName", "concat(ErrorDescr, Markerid)")
1
This error is pretty much explained here and it helped me to get assignments and return values for all variables.
0
Have a look here: http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries. This gives you links to GDAL binaries for all sorts of operating systems and the first item is for ELGIS, supposedly including RHEL. Also see here.
I mostly use Windows and get my binaries from the excellent gisinternals link further down the page, so I can't vouch for the ...
3
See the OGR Projections tutorial and the OGRSpatialReference class. In particular, the GetAttrValue method.
Here's a worked example.
from osgeo import gdal,osr
ds=gdal.Open(r'SOMERASTER.TIF')
prj=ds.GetProjection()
print prj
srs=osr.SpatialReference(wkt=prj)
if srs.IsProjected:
print srs.GetAttrValue('projcs')
print srs.GetAttrValue('geogcs')
For my ...
0
If you data is stored in a database SQL server postgres etc. you can use pyodbc to connect to the database and the use cursor.execute(SQL) to do queries, and write to a csv.
2
You are missing:
from qgis.core import QgsFeature
at the top of your script
1
This should work; it worked for me. This will give you a group layer named by the folder and a layer with the name of the shapefile. I built off what artwork21 posted.
import os
import arcpy
WS = r'c:\test_define'
arcpy.env.workspace = "in_memory"
mxd = arcpy.mapping.MapDocument(r"c:\test_define\test_python_add2.mxd")
df = ...
0
You can get group names within map document by:
layers = arcpy.mapping.ListLayers(mxd)
for layer in layers:
if layer.isGroupLayer and layer.name == "Group":
newname = str(yourfoldername)
layer.name = newname
mxd.save()
0
Try the test code below which should create a test file geodatabase table called xxx, with three fields (FieldA, FieldB, FieldC) and inserts a single row. It then uses FieldInfo, MakeTableView and CopyRows to output a dBase, personal geodatabase and file geodatabase table with FieldA renamed to FieldD and Field B removed. I think this is what you are ...
Top 50 recent answers are included


