Tag Info

New answers tagged

3

Here's some quick-and-dirty Python code that works on a simple shapefile layer: # Get the currently selected layer inLayer = iface.activeLayer() # Get its list of fields inFields = inLayer.dataProvider().fields() # Convert its geometry type enum to a string we can pass to # QgsVectorLayer's constructor inLayerGeometryType = ...


1

There are a couple of ways to make your contours smoother. Looking at the contours, I suspect it's because the IDW raster is low resolution. Did you use the default size (300x300) when creating this? Resize your IDW raster Probably the easiest way :- take your existing IDW raster and make it bigger with gdal warp (Raster > Projections > Warp). ...


0

I started to dive into VTK - The Visualization ToolKit (VTK) is an open source, freely available software system for 3D computer graphics. It is pretty powerful and robust tool, seems to be able to do all the operations I asked for though I can't confirm it all yet. On the other hand it doesn't support datum and projection as is expected from GIS software. ...


1

You can use the GroupStats plugin to achieve your goals. Just make sure to add the area column to your data table. Here's a link to a tutorial for the plugin GroupStats


0

In case I understand correctly, the common attribute for your groups is a weight attribute? Then you could use any of the dissolve functions in the toolbox, using that weight-field for dissolving (receiving probably multipart polygons). Next step would be to add a new area-field to your layer in the field calculator, using the $area expression to calculate ...


2

zoom to the extent you're after optionally, ctrl-b to save the extent rectangle select the polygons (drag over the whole canvas extent) vector > geometry tools > buffer (selected features only, distance .001 or less, dissolve results) This will expand the coastline outwards just enough to overlap across the line, the dissolve will 'heal' the gap. You ...


0

Ok, here is the method I came up with and works for me. Union feature class by itself Use Find Identical on the unioned file Join the unioned file to the table produced in step 2. by the ObjectID and IN_FID fields. Dissolve by "FEAT_SEQ" field, putting the sum of the score in the statistics field.


2

The mistake is in this line: layer = self.iface.addVectorLayer("D:/python/cropped_area.shp", "sample_cropped area","ogr") The layer is added anew each time selectFeature is fired. You'd rather want to add the layer once (e.g. in the __init__ or initGui function), and save it to a member of your plugin object (e.g. self.layer=addVectorLayer(…)) so you can ...


1

What you are trying to do is referred to as zonal statistics. QGIS has a zonal statistics plugin which, among other things, will compute the majority. Execute it on each raster layer and your attribute table should be propagated with the relevant statistics.


1

Hope this works for anyone looking for something similar. This is just the tangent angle. Getting an actual line tangent with this angle is just a matter of using ST_Project(point_in_line, tangent_length, north_heading) or regular vector construction from an angle The inputs are the line you want to calculate the tangent from and a point to project into the ...


1

One way to do this is using canvas. Here's a working solution: html2canvas This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the ...


2

Intersect will give you polygons representing the overlap. Then you can use Dissolve with a statistic of sum on your value field. Finally, you can Merge/Append back to the original dataset:


3

It is unclear on what you mean by columns. As far as I can tell you are subsetting and ploting rows, not columns. Your "ranks" variable is not a factor so, "nlevels" is returning 0. Replace "nlevels" with "length(unique())" or coerce the data to a factor using "as.factor" rather than "as.numeric" around your call to "lapply". The reclass function has a ...


4

You can use the merge function as there is now a default method for sp class objects. Add sp and the sp "meuse" data (SpatialPointsDataFrame) library(sp) data(meuse) coordinates(meuse) <- ~x+y Add "ID" column to "meuse" meuse@data <- data.frame(ID=1:nrow(meuse), meuse@data) Create a data.frame "df.new" with "IDS" (note different name) and "y" ...


1

Thanks to user30184, I managed to solve the problem. It seems that the version of the GDAL I had installed, which was 1.11.1, had a problem with the function gdal_polygonize.py. I installed the newest version of GDAL (2.0.0) and it works perfectly!


6

It sounds like you want to subset your data and plotting is secondary. Please keep in mind that it is not always necessary to create a new object. If you are only wanting to plot subsets of the data it is far more efficient to take @fdetsch advice and subset in the call to plot. Here are some examples of subseting and plotting sp class data using the meuse ...


1

As Gabor said, I was adding the geometry and not a feature to the source. I was also missing [] on the coordinates to the geometry, and wasn't converting properly. Outside of here, I was using lat/long as x/y instead of y/x. Updated fiddle: http://jsfiddle.net/Kieveli/f4t6n6v1/7/ HTML: <div id="map" class="map"></div> JAVASCRIPT: var ...


0

The Profile Graph tool in ArcGIS does not work if the input DEM and the selected line feature are not in the same coordinate system. To test this statement, I used a DEM in UTM coordinates and a line feature class in US State Plane. My result was a graph with a constant elevation of one. I reprojected the line feature class to the UTM coordinate system and ...



Top 50 recent answers are included