Tag Info

Hot answers tagged

5

I don't think you can remove features from a selection layer once it's been created, but the workaround that I usually use is to create a new selection layer from your existing one: Select the features in your selection layer that you want to remove. Open the selection layer's attribute table and click Switch Selection, which will make all the features ...


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", ...


4

The Extent object supports a 'disjoint' (i.e. does not intersect) method. Try something like: for mxdname in arcpy.ListFiles('*.mxd'): print mxdname mxd = arcpy.mapping.MapDocument(os.path.join(env.workspace, mxdname)) df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] for lyr in arcpy.mapping.ListLayers(mxd, "" ,df): if ...


2

One way to do this is to create a polygon feature layer of the dataframe extent, then you may select features in your dataframe to see if they intersect the extent polygon. http://anothergisblog.blogspot.com/2011/06/dataframe-object.html mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] layers = ...


2

You need to filter away those map documents which contain "land use" in their names. It is better to test and if the evaluation gave us "false", proceed with the processing. env.workspace = r"C:\Project" Layer1 = arcpy.mapping.Layer("abc.lyr") for mxd in arcpy.ListFiles("*.mxd"): if 'land use' not in mxd: print mxd mapdoc = ...


2

I think the issue is that you are trying to save a service layer. I couldn't tell you why it doesn't work through Python, but I have had similar issues with database joins and symbology. They work when I do it by hand, but not when I try and script it, it doesn't work. Even though it seems like it's the same task. In these situations I had to move to ...


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 ...


1

Ok, the first error is easy to avoid. It's failing because you are trying to find the datasource of a group layer, and group layers don't have data sources. Filter the group layers out by doing this: for lyr in arcpy.mapping.ListLayers(mxd, "" ,df): if not lyr.supports("DATASOURCE"): continue #further code here for non-group layers ...


1

The functionnality has been added recently, see these 2 examples : Tile load events , Image load events


1

This is how I would form the query you're asking about using ST_MakeEnvelope() and the && operator. You can request whatever field data you want, in addition to the geometry in GeoJSON format using ST_AsGeoJSON(). Also I recommend taking advantage of that function's ability to specify a max decimal precision value. Here I'm requesting geometries ...


1

A few days late, but here's a workflow that did what I needed. Open up qGIS ( http://www.qgis.org/en/site/ ) Set up your projection under project -> project properties (I use NAD83 / Alberta 3TM ref merid 114 W EPSG:3776 but hey whatever look you want try a few) and make sure on the fly CRS transformation is checked. Add your .shp : Layer -> add vector ...


1

Does the problem also occur in the Python Window? Like: import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df1 = arcpy.mapping.ListDataFrames(mxd)[0] lyr = arcpy.mapping.ListLayers(mxd, "*", df1)[0] arcpy.SaveToLayerFile_management(lyr,"""D:/test.lyr""",'#') (I am using 10.0 so there are only 3 arguments for SaveToLayerFile_management())


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".


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.


1

Needed to exclude the last two layers from the layerswitcher by adding a -2 to length like so: for (i = 0, ii = layers.length-2; i < ii; ++i) layers[i].setVisible(i==checkedLayer); This makes the layers visible on load, so set them to false like so: layers[4] = new ol.source.TileWMS({ Visible: false, source: new ...



Only top voted, non community-wiki answers of a minimum length are eligible