Tag Info

New answers tagged

2

Finally I found the answer : using the QgsLegendModelV2()class, and its functions inherited from QgsLayerTreeModel : "index(i,j)" to select each legend item and "rowcount" to obtain the rows number. All in a "for x in xrange" loop. That gives: for i in self.composition.items(): if isinstance(i,QgsComposerLegend): legend = i for i in ...


0

There are a wide means of referencing layers within a table of contents. Just check out the various layer properties available. For example, if you wish to find a layer by name, perform your ListLayers and then make use of an if lyr.name == "mylayer": statement in your for loop.


1

As somebody told in an ESRI forum in 2003 "Feature Layer is a layer in your map" so it means that a Feature Layer is a single entity (polilyne, point or polygon) wich can be put as a simple object in your map or consider as a "mask" of a "Feature Class". But "Feature Class is a dataset that resides on disk".


5

Here's the ListLayers documentation ListLayers(map_document_or_layer, {wildcard}, {data_frame}) You can use a wildcard if you know the name of the layer. mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] road_layer = arcpy.mapping.ListLayers(mxd, "Road", df)[0] river_layer = arcpy.mapping.ListLayers(mxd, "River", ...


0

Found the problem... The feature class had somehow become corrupted and converted itself into a table (even though it still confusingly displayed it's XY data on the map). Will fix the layer and it should work !


0

you might try referencing the layer myLayerRef = arcpy.mapping.Layer("path to your layer" or layer var) arcpy.SaveToLayerFile_management(myLayerRef, "D:\Data\Workspace\Test.lyr")


1

I'm not sure what you're trying to do with the output file name, but constructing it like that will not work - the path needs to start with C:\. Also, in Python it's good practice to use os.path.join to add paths together, e.g. import os ... arcpy.mapping.ExportToPDF(mxd, os.path.join(r"C:\Project_7\Newer_data\Inverts\GO", PDFPath, lyr.name + ".pdf")) ...


1

I'd use data driven pages, each covering the same extent of the map. You can show/hide layers in the view if there is a field to store pages name. Add field to every layer and populate it with relevant page name. Use definition query window of the layer to show/hide it using match/don't match options.


6

GDAL suppports that so it should be possible for QGIS as well. However, I could not make it work with my QGIS 2.6.0. Perhaps there is just some missing step and somebody can point what it is. Test with GDAL and VSICURL gdalinfo /vsicurl/http://dl.maptools.org/dl/geotiff/samples/made_up/bogota.tif Driver: GTiff/GeoTIFF Files: ...


1

OK, here is the script I wrote a while back, and I just adjusted it for US States, but it will work for any kind of data, as long as it contains a column with unique values. import arcpy print 'imports over' arcpy.env.overwriteOutput = True # load dataset states = r"F:\Data\States\States_2010.shp" # create feature layer ...


3

Error 010246 from ESRI support describe either a state that all input points have the same location, or that one or none point were selected. I believe that the second one applies to your model. I suggest you manually check whethear some polygons don't contain points at all, or contain one point - you might use spatial join to get the counts. After that ...


1

I suggest a model-builder based solution. You can create a simple work flow that look as follow: Iterate by row selection extract the Name of each country using Get Field Value (model tools) Save Selected with Country name using the copy features tool; using %I_NAME% to mark feature name with the selected country name, where I_NAME is the variable name of ...


5

Split Layers by Attributes check out this python toolbox. Split Layer by Attributes, State Name, being the attribute you want.


0

Not sure if this will help anybody, but i stumbled upon this same issue. I'm basically trying to add all layers that have a SHAPE column to a combobox in a Python Addin. I was testing each layer in the data frame's isFeatureLayer property, but then discovered that annotation feature classes aren't considered feature layers. So then I was going to use ...


0

This could potentially be down to the two different layer panels: One is Layer order and the other is Layers: Untick the "Control rendering order" in the Layer order panel, which will then allow you to control it through the main Layers panel. To turn these on and off use the: View>Panels menu


1

After adding the layer to the in-memory mxd, you should save the mxd using: mxd.save() or mxd.saveACopy (r"D:/arcgisserver/directories/my_mxd2.mxd") to change the layer name, simply change the name property of the layer: addLayer.name = "NewLayerName" Update: To rename the newly added layer you should make a reference to the layer first: allLayers= ...


3

First, feature classes don't have symbology attributes. Symbology is attributed to layers in ArcGIS. When you add a feature class to a table of contents in ArcMap, a layer is created, though not saved anywhere as a .lyr file. If you are having your users add a feature class to ArcMap that they then symbolize as desired, below is the way of saving that ...


1

This should work: import arcpy, os, sys InFolder = sys.argv[1] OutFolder = sys.argv[2] arcpy.env.workspace = InFolder for ThisRas in arcpy.ListRasters(): arcpy.MakeRasterLayer_management (ThisRas,"Layer"); arcpy.SaveToLayerFile_management("Layer",OutFolder + "\\" + ThisRas + ".lyr",True,"CURRENT"); arcpy.Delete_management("Layer") It ...


0

Add all of your Tiffs to map by dragging them from ArcCatalog. then use this code in python windows: import arcpy from arcpy import env mxd = arcpy.mapping.MapDocument("CURRENT") env.workspace = "d:/Layers" for lyr in arcpy.mapping.ListLayers(mxd): print lyr.name try: arcpy.SaveToLayerFile_management(lyr, lyr.name + ".lyr", "RELATIVE") ...


1

Perhaps the calculator is your answer. From "Raster-Raster Calculator" you can create new layers from others. For the the intersection you can use the "AND".



Top 50 recent answers are included