Hot answers tagged

25

Vector data can have properties stored at two levels. File level or Layer level. For feature class (a type of vector data), file level information is stored in a geodatabase. This consists of properties like feature class geometry, attribute table, assigned subtypes and domains, a coordinate system, etc:. All these file level properties make up the actual ...


18

My thoughts are: Export your shapefile to a file geodatabase feature class - I think its drawing performance will be better but am not sure by how much If you are using ArcGIS Desktop 10.0 or later move it into a Basemap Layer - this will improve drawing performance dramatically If you like the sound of pyramids for vector data, be sure to vote for this ...


17

The MultiQML plugin lets you apply one QGIS layer style to multiple layers at once. I think that's as close to what you are looking for as currently possible.


11

which layer do you want, i dont understand? but getting all layer: map.layers getting all layer name: var mLayers = map.layers; for(var a = 0; a < mLayers.length; a++ ){ alert(mLayers[a].name) }; getting last added layer name: map.layers.getLast().name and beside this you can use all this method too: 1.map.getLayer() 2.map.getLayerIndex() ...


11

Do you want to actually delete the layer from the geodatabase or remove it from the mxd? If you just want to remove the layer from your mxd, replace arcpy.Delete_management("CADAnnotation") with arcpy.mapping.RemoveLayer(df, lyr) If you want to delete the data source you can do this. for item in mxds: print (item) mxd = ...


11

If I got you right, the answer is yes, QGIS supports dynamic layer names. You would need to write a Python macro to be ran every time the project is opened. This would be the workflow: Go to on QGIS->Project->Project Properties and replace openProject() with the following Python code: def openProject(): import re, qgis iface = ...


11

Decrease the height of the the legend box to zero: In the example below you can see that I got a line legend even if my data is polygon. Right-click on your legend, click on properties Go to the Legend tab and change the height into either 1 or 0. That will reduce all polygon layer patches in the legend to lines. You can also set this property per-layer, ...


10

Direct tile access is not allowed by Google (and this is what ArcBruTile is doing). Usually this will get your IP address banned for awhile but they could also come after you for violating their TOS. fwiw, Arc2Earth will be adding support for this functionality in the next build. Instead of needing a Google Maps Premium license, you can purchase access at ...


9

Try... # substitute 'self' with 'qgis.utils.iface' when run from Python console # 'self.iface = iface' would usually precede this command in your class layers = self.iface.legendInterface().layers() for layer in layers: layerType = layer.type() if layerType == QgsMapLayer.VectorLayer: # do some stuff here Culled from consolidatethread.py ...


9

The easiest solution is to select the road segment(s) on the map or in attribute table and copy-paste (Ctrl-C - Ctrl-V) them into a text editor. You'll get the WKT string of the geometry with all its node coordinates. If you want to export the whole layer, an easy solution is to use "Save as ..." to CSV and specify OGR creation option "GEOMETRY=AS_XYZ" or ...


9

The workaround I usually use for any situation in which I want to customize the legend entry for a layer is to create a dummy layer which is only used in the legend, and not displayed on the map. So in your case, create a new line layer using a line shapefile with no features in it, symbolize it however you want, and add that to your legend. The new layer ...


9

I used to work in that exact same environment (the exact same one!). I have not done any benchmark testing but my sense of this is that number of layers in the project doesn't have much effect by itself. In my experience the labeling and number of features is a much bigger issue than the number of layers (especially if many are turned off). I used to have ...


8

There is a direct answer to your question on this link at StackOverflow: How do I add a shapefile in ArcGIS via python scripting? It is copied below with some modifications for clarity: Variable "theShape" is the path of the shape file to be added. import arcpy import arcpy.mapping # get the map document theShape = ...


8

These terms specifically relate to the ESRI software and data schemas. A feature class is a set of common geographic features, for example roads, or parcels, or land use, as they are stored in a geodatabase or shapefile, or other storage format. Here is the help file on Feature Class Basics. A feature layer is the representation of a feature class after ...


8

According to the docs here, you can pass the position in as an option when creating the layer control. Available positions are outlined here overlayPane = { "Endpoints" : endpointMarkerLayer, "Links" : linkLineLayer, }; // Add a layer control element to the map layerControl = L.control.layers(null, overlayPane, {position: 'topleft'}); ...


8

A SearchCursor in arcpy is the most direct route for accomplishing this: import arcpy fc = "c:/data/base.gdb/roads" field = "StreetName" cursor = arcpy.SearchCursor(fc) row = cursor.next() while row: print(row.getValue(field)) row = cursor.next() Note that you can use the where_clause property to perform your selection.


8

There is no universal vector format in GIS. However, some formats are proprietary and other are openly specified (like the shapefile) so that they can be read and/or written by other softwares (if they decide to implement). For data sharing, the best solution to date is to use shapefile, which is now the most widespread format. Shapefile is however an old ...


8

Out of the box, field calculator does not support spatial joins across feature layers. But, if you have a look at NathanW's post on the function editor for qgis expressions you will be able to make out that we can script our own data interaction. The following script will allow you to express what you're after. It works by iterating through all features ...


8

A translation is an affine transformation. Next code includes this kind of transformation and it works well at the Python Console of QGIS for creating a memory layer with the displaced layer (building1). registry = QgsMapLayerRegistry.instance() n = registry.count() layers = registry.mapLayers().values() layers_names = [ layers[i].name() for i in ...


7

You can create an in-memory RasterLayer by using arcpy.MakeRasterLayer to create the layer without an .lyr file and then add it to your DataFrame. The following code will load a raster into a new raster layer, add it to the first dataframe of the specified mxd, and then save the mxd. mxdPath = r'{path to mxd}' rasterPath = r'{path to raster file}' ...


7

This appears to be related to the map document's (MXD) default database and relative paths. See the ESRI Help for details on relative paths. Relative paths are generally a good thing. I'm not sure if this would be a bug, but is certainly a gotcha. The resolution is to uncheck the "Store relative paths..." option in the map document properties of the ...


7

The documentation entitled Updating and fixing data sources with arcpy.mapping has several examples: There are numerous reasons why data sources need to be repaired or redirected to different locations. The idea of making these changes manually in every affected map document can be overwhelming. Methods are available with the arcpy.mapping ...


7

There are also two other ways: layers = self.iface.mapCanvas().layers() will give you a list of layers or layer = QgsMapLayerRegistry.instance().mapLayers() for name, layer in layers.iteritems(): print name, layer.type()


7

How about this: OpenLayers + any base map you want (or blank) & your data layers & GOOGLE MAPS layer with Custom Styles [search here on SE] as a data layer, not basemap => google maps custom styles created here: http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html and here's one style that seems to work ok: Google ...


7

Yes, there is. Go to Options in the Settings menu and open the tab Map tools. Then you can set the Identify Mode. You probably want the Top down, stop at first.


7

You need to create the MapDocument and DataFrame objects outside of the loop that runs through your layers. Otherwise you are starting with the original map each time. so i will correct in this code: mxd = arcpy.mapping.MapDocument("CURRENT") dataFrame = arcpy.mapping.ListDataFrames(mxd, "*")[0] for layer in shp_List: outlayer = layer + "_lyr" ...


7

You can do this by using Layer Groups. In the Admin interface, Under the 'Data' section on the left click on 'Layer Groups'. Then, in the usual GeoServer way, create a new layer group (by default you may already have a couple of examples) and then follow the intuitive interface to add layers to the group. Once you have your Layer Group created, go back ...


7

Use an imageOverlay layer. You only need to specify the bounding box of the image. Check the example of the API documentation: var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg', imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]]; L.imageOverlay(imageUrl, imageBounds).addTo(map);


7

It is not as easy as it used to be, but there are some helper methods for the collection. That should allow you to do similar things as ThomasG77 described above. Assuming you have a map named map, with 4 layers i.e. [base_layer, coastlines, heatmap, markers] Then you can get the collection via map.getLayers(), and the array of layers via ...


6

for QGIS 2.6 here is the code to identify each layer and group them #make the desired groups for layers root = QgsProject.instance().layerTreeRoot() group1 = root.insertGroup(0, "Group Point") group2 = root.insertGroup(1, "Group Line") group3 = root.insertGroup(2, "Group Polygon") #get the list of layers ...



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