Tag Info

Hot answers tagged

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


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


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


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


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


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


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:


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


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


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

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!


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


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



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