Hot answers tagged

9

Using PostGIS, I used ST_ConvexHull to simplify the polygon for a faster result: Get the furthest Point: SELECT ST_PointN(ST_ExteriorRing(ST_ConvexHull(the_geom)),Generate_Series(1, ST_NPoints(ST_ExteriorRing(ST_ConvexHull(the_geom))))) as FarPoint FROM PolyTable; And if you are interested in creating a Circle from the centroid: SELECT ST_Buffer(Center,...


8

There used to be a tool in GRASS called Line of sight which did exactly what you were after but its been deprecated because it was pretty slow on big datasets as mentioned here. Anyway you can use the GRASS program r.viewshed from the processing toolbox. Basically you provide a DEM and an observer point in coordinates and you will get a grid (i think ...


7

There are a couple of different approaches to that: Start a new project iface.newProject() Add a layer Whenever a new layer gets added to the mapcanvas, the welcome page will disappear Change the configuration In contrast to the other two approaches, this changes the configuration of the QGIS installation permanently. # 0: Welcome page # 1: Most ...


6

From the label settings window, there's another hidden spot where you can toggle all labels. At the top right, click the yellow four-direction arrow button and place a check beside Show all labels and features for all layers. Note that that will affect all layers, not just the one you're working with.


5

Pressing the Help button takes you to the tool's documentation on the GDAL homepage: roughness This command outputs a single-band raster with values computed from the elevation. Roughness is the largest inter-cell difference of a central pixel and its surrounding cell, as defined in Wilson et al (2007, Marine Geodesy 30:3-35). Sounds like the ...


5

I see the same issue. Took a look at this file in InkScape, and used Shift-Ctrl-F to bring up the Fill and Stroke properties. I noticed that the fill on your green and blue areas were set to 'pattern fill', stripes 1:1. Make a note of your blue and green colours first. Next, change to use 'Flat Color' on both the coloured areas, then reselect your colours ...


4

In the attribute view create your new columns as decimal (floats). Then enable editing, and use expressions to update the columns. To get the latitude (x-coordinate) of the start of a line feature, use the expression x_at(0). To get the end of a line feature use x_at(-1). Repeat for your longitudes (y-coordinates). You select the column, type in the ...


4

You have your four columns: X-start; Y-start; X-end; Y-end. Using the field calculator for each column update using: $x_at(0) $x_at(-1) $y_at(0) $y_at(-1) This asks for the coordinate at the start of the line (the zero) and the end of the line (the negative one). This will provide you with a decimal latitude and longitude, so ensure the columns are ...


4

You need to download QGIS 2.14.3 from OSGEO4W in order to be able to open ECW file format. The QGIS help stated that clearly. Also, here is a good source on ADDING ECW SUPPORT IN QGIS. The help provides good information on how to open ECW file format using different operating system.


3

Kludgy method: Suppose your residuals go from -1 to +2 (use the "Statist" plugin to get the range of your attribute) Create a dummy point (or other geometry) with residual -2. Style as normal with an odd number of categories, white in the middle. Make your dummy point invisible with some other style rule, or maybe delete it (but don't reclassify!). Or ...


3

As mentioned in the comment, you could create a model from the Processing Toolbox but if you want to create a script, you could use the following which creates the start_lat field and updates it for each layer (comments are included which hopefully will help): # Import required module to create field from PyQt4.QtCore import QVariant # For each layer in ...


3

The widgets which you are referring to are leftovers from Qt3. QGIS at the moment is based on Qt4 (which exists since 2005 and has seen end of life in December 2015) and is soon to be updated to Qt5 (2016/2017). Ten years ago, when it was about moving applications from Qt3 to Qt4, a Qt3Support module has been introduced to ease the migration. However, ...


3

Using next PyQGIS code (1 hour ago this answer had QGIS tag): from math import sqrt layer = iface.activeLayer() feats = [ feat for feat in layer.getFeatures() ] n = len(feats) centroids = [ feat.geometry().centroid().asPoint() for feat in feats ] polygons = [ feat.geometry().asPolygon()[0] for feat in feats ] lengths = [] for i, pol in enumerate(...


3

Here's a couple of methods: Select your counties again and then select from the menubar: Vector > Geoprocessing Tools > Dissolve and check the Use only selected features. Click the Edit button on your shapefile, selected your features and then from the menubar: Edit > Merge Selected Features If you still receive errors then you may ...


3

The reason for this issue is comparitively simple. Cp. Screehshot for an idea of the spreadsheet I had to process. These beautiful colored, linebreaked nicely human readable spreadsheets are an invention of satan himself. This Spreadsheet was so full of formatting, blanks, special characters and linebreaks in column headers, cross references,... that a ...


2

I solved the Problem by starting QGIS with administrator rights (rightclick on the QGIS icon "start with admininstrator rights"). This maybe only a solution in my case, because of my IT Environment.


2

after adding some print statements after each line I managed to work out that it's symbol.changeSymbolLayer(0, symbol_layer): bool QgsSymbolV2::changeSymbolLayer( int index, QgsSymbolLayerV2* layer ) { QgsSymbolLayerV2* oldLayer = mLayers.value( index ); if ( oldLayer == layer ) return false; if ( !layer || !layer->...


2

According to gdal.org/drv_csv, you can define width and precision in the csvt file. BUT: According to Why are some columns not recognized as numeric even though I have a CSVT?, QGIS does NOT read the csvt with Add delimited text. Instead, it makes some kind of educated guess about the data types Try Add Vector Layer instead. Draging and dropping the csv ...


2

Are you doing this through the attribute table dialog? If so, I'd suggest removing the field from the layer properties -> fields panel instead.


2

Looks like you're using a CRS in metres but trying the style it using a degrees based format. You'll either need to set the grid projection to a geographic one (ie WGS84), or use a different coordinate format.


2

Yes that can be done. First make a startup.py file in .qgis2\python Add the following code from PyQt4.QtGui import * docks = iface.mainWindow().findChildren(QDockWidget) for dock in docks: dock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetMovable) Now on QGIS startup it will remove the close button from all docks. If you need ...


2

Beware that the Shapely (Python) / GEOS (C++) data model is defined in a plane. So if your points consist of GPS positions (latitude, longitude) using the shapely.geometry.LineString.interpolate(distance) method will output a GPS position at the euclidean distance along the given LineString. Shapely's interpolate() is based on GEOS' geos::linearref::...


2

There is no fault in the data or python script. QGIS's default for opening a raster dataset looks for a minimum and maximum value to provide band rendering. However, this dataset contains a single value. Within QGIS's layer properties style menu by setting both the Min and Max values of the dataset to the single dataset value and selecting "No enhancement"...


2

After trying several attempts the following successfully worked: (a-b)


2

It looks like you are working with MapInfo. The "Distance Calculator" (find it in tool manager) has many options and I think it can handle this task too. There is an article about it here: http://web.pb.com/mapinfopro-jul-2013/Toolbox-Distance-Calculator


2

The general logic for setting border color is: # black polygon with red border symbol = QgsSymbolV2.defaultSymbol(layer.geometryType()) layer_style = {} layer_style['color'] = '0, 0, 0' layer_style['size'] = '2.5' layer_style['color_border'] = '255, 0, 0' symbol_layer = QgsSimpleFillSymbolLayerV2.create(layer_style)


2

If I understand what you are trying to do, you don't need to dissolve, you just need to summarize by landscape zone after intersecting the two datasets. If you do this in a geodatabase the area of each polygon is calculated when the intersection is completed.


2

Your escaping isn't write quite right. It should be: (\"accdate\" >= '1990-01-01' AND \"accdate\" <= '1992-12-31') (You have some extra "s) Also note that: iter = lyr.getFeatures(request) ids = [i.id() for i in iter] lyr.setSelectedFeatures(ids) selected_feats = lyr.selectedFeatures() Is quite inefficient. Try: iter = lyr.getFeatures(request) ...


2

Depending on what attributes you have in your states you can join them based on location using QGIS. The tool can be found at "Vector"-"Data Management"-"Join attributes based on location". Your target will be your shp1. It then should bring you all attributes from your states.


2

Not sure how to modify the interface of such scripts but you could use an example script like the following where the Enter_field parameter has a default string of ID and if a field name matches this, it prints this field name otherwise it will print the one that is selected in the Or_select_field parameter: ##Example=name ##Input_layer=vector ##...



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