Hot answers tagged

29

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


20

This is a wicked problem. We've tried various systems, which have all worked to varying degree for a time, and eventually grown unwieldly and started to fall apart as more and edge cases which don't quite fit are encountered. That said, each of the systems we've used is way better than nothing, proving the maxim that any system is better than no system. ...


19

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.


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 Delete tool should accept the name of a feature layer to remove it from the TOC. Permanently deletes data from disk. All types of geographic data supported by ArcGIS, as well as toolboxes and workspaces (folders, geodatabases), can be deleted. If the specified item is a workspace, all contained items are also deleted. and under the Syntax ...


14

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 = arcpy.mapping.MapDocument(...


12

For ArcGIS 10.0, if you can make use of a read-only approach, the following code sample reveals the field (and joined table) that forms the basis for the symbology of a layer. It exports a temporary msd(a zip containing xml files) and loads the specific attributes into an object. These classes might be extended to gain access to additional layer attributes....


12

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 QGIS->Project->Project Properties and replace openProject() with the following Python code: def openProject(): import re, qgis iface = qgis.utils....


11

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


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() 3....


11

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


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


11

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


10

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()


9

ArcPy looks to let you change the symbology, but only with existing .lyr files, and not specify the symbols directly in your code based on my reading of the module.


9

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


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

To georeference a vector layer, try the qgsAffine plugin. More info here: Where to find qgsaffine in the menu?


9

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'}); layerControl....


9

The hint provided by @mdsummer of using byid=TRUE works accurately. See the reproducible example, below: library(rgeos) library(sp) #Create SpatialPlygons objects polygon1 <- readWKT("POLYGON((-190 -50, -200 -10, -110 20, -190 -50))") #polygon 1 polygon2 <- readWKT("POLYGON((-180 -20, -140 55, 10 0, -140 -60, -180 -20))") #polygon 2 par(mfrow = c(1,...


9

If anyone get stuck with identifying layer type in OpenLayers 3, there is a more sophisticated, JavaScript method to achieve this. As layer objects are created with layer constructors, the native instanceof JavaScript function can be used to check for layer type. As the identification of a layer type usually gets into an if or switch clause, one could ...


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


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 = r"C:\Data\Environmental\Floodplain....


8

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


8

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


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

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);


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

Assuming you use an ol.layer.Vector with an ol.source.GeoJSON you can use something like this: var vectorSource = new ol.source.GeoJSON({ projection : 'EPSG:3857', url: 'http://examples.org/fearures.json' }); var vectorLayer = new ol.layer.Vector({ source: vectorSource }); map.addLayer(vectorLayer); // show loading icon // ... var listenerKey = ...


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



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