Tag Info

Hot answers tagged

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


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


6

This is part of the raison d'ĂȘtre of the OGC. Regarding vector data you may wish to look into these standards: Geographic Markup Language (GML) - an XML grammar for the storage of geographical features. It serves as an open interchange format for the transaction of geo-spatial data between different software. Web Feature Service (WFS) - provides an ...


6

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

AndreJ and SS_Rebellious provide valid answers. However, there is another option which I find easier than creating the group and dragging layers in to it. You can select all the layers you want in your group (select multiple layers by holding down shift which selects everything between your first selected layer and the second one you click on, or hold ...


6

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


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


5

The reason you cannot edit these layers is because it is not a file. It is a map service. What you are seeing is a web service. A web service is data that is hosted on a server elsewhere, that is not your computer. Your computer is going out and getting the data live from OLIVER when you look at it in ArcMap. In this case the data you want to edit is ...


5

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


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


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

Yes, very simple: Just use the Categorized Symbology. If you do not have any attributes, you can just use $id as your "Column". Result:


4

The newest and most promising that exists is OGC GeoPackage. The standard was published in February, 2014 and it will take some time before GIS programs support it properly but the list of implementations at http://www.geopackage.org/ is growing fast. There are already well known programs on the list, including ArcGIS, GDAL, and GeoServer. Unlike GML which ...


4

You don't have to save your annotations as a layer. Simply toggle the Text Annotation function in the toolbar and press Ctrl + T to switch it on/off. Your annotations will be saved within your project.


4

It would be better to remove the layer using arcpy.mapping.RemoveLayer. The parameters are the data frame to remove the layer from (possibly a group layer if you are trying to remove from a group) and the layer itself, this alleviates any chance of confusion: def onClick(self): mxd = arcpy.mapping.MapDocument("CURRENT") df = ...


4

http://qgis.org/api/2.2/classQgsSymbolV2.html#aa2c7db61d4234bddf3aa62f294ad6818 void QgsSymbolV2::setColor(const QColor & color) with python: myColour = QtGui.QColor('#ffee00') mySymbol1 = QgsSymbolV2.defaultSymbol(myVectorLayer.geometryType()) mySymbol1.setColor(myColour)


4

Try something like: map.getLayers().setAt(99, markers) The list of layers is in an object inheriting from an ol.Collection. See the API doc for it. Be careful, I'm pretty sure, you can't use arbitrary number like 99 in setAt: first arg is for the position in the array of layers and the second arg is for the layer element reference you want to move. To ...


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


4

In Python a backslash is an escape character. In order to put a backslash in the string you need to need to put another backslash next to it to stop it from forcing a new line. myString = "this is\\ a string with a backslash" I can see your paths are set correctly but maybe the strings you are parsing only have a single backslash. You can solve this ...


4

Actually, logically Union is the the area shared by both plus the area of each of the two layers not shared by the other. Therefore the area returned must be equal to or greater than the area in the largest layer. This is what you are seeing. The way to extract just the portion where the land use layer and the limit layer intersect is to use the Intersect ...


4

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


3

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


3

According to your edit, you want to create a map (layers, featured services etc) using ArcGis for Desktop, which in turn will be used via the Javascript API in my application This is simply not possible. When you publish a map as MapService, it takes on the projection of the Map. In ArcGIS for Desktop, there is no out of the box way to change the ...


3

You can store your annotations in a point layer and label it by [Right click >> Properties]. Follow the simple steps below: Make sure your point feature is not visible. only the label is visible. Right click on layer >>properties>> Style tab. Select Simple marker or simple choose any hollow marker and set Size to 0.00000 as shown in below snap. Click ...


3

I just tested using ArcGIS 10.2.2 for Desktop and my expectation was that highlighting a layer (or layer group) in the Table of Contents would activate the Remove button on the Standard toolbar - but it did not. I also tried the Delete key and Ctrl-X but neither of them allow you to remove a selected layer either. As far as I can tell the only ways to ...


3

This could easily be converted into a toolbox script or run directly from the python window in Arcmap. It can be improved by validating the layer name before copying, duplicate naming conventions, drilling into group layers, using different data frames, etc. But this should get you started for a simple TOC: import os, arcpy folder = "path\to\folder" ...


3

By using the new Layer tree (aka legend or ToC) added by Martin Dobias since QGIS v.2.4, you can load a layer to the top of the ToC following these steps: Get a reference of the layer tree root = QgsProject.instance().layerTreeRoot() Create the layer object from PyQt4.QtCore import QFileInfo fileName = "/path/to/raster/file.tif" fileInfo = ...


3

Nick Ochoski is right about the SearchCursor, but there is a cleaner way to use it WITHOUT a while and manually calling next: import arcpy fc = "c:/data/base.gdb/roads" field = "StreetName" cursor = arcpy.SearchCursor(fc) for row in cursor: print(row.getValue(field))


3

First you need to make sure that your watershed are polygons. If not : feature to polygon. Then you can make the intersection (intersect_analysis) between your watershed and your lines. You'll end up with lines that have the fields of the waershed as an attribute table. You can then use summary statstics to have the total length for each watershed. Note ...


3

I think you should check that you are using the List By Drawing Order view of your Table of Contents. Of the four views described in Using the table of contents it is the only one which will allow you to change the drawing order.



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