Hot answers tagged

5

Step 1 Make bit rasters for each of the unique classes. This can be a 1-band rasters for each class, or a single raster with a band for each class (e.g. GeoTIFF). If using GTiff, you can use the creation option NBITS=1 to conserve space. You may also want to consider twobit rasters to store three-valued logic where the third (e.g. 2) is NODATA, which would ...


4

sp provides a shorter form to select features based on spatial intersection, following the OP example: pts[ply,] as of: points(pts[ply,], col = 'red') Behind the scenes this is short for pts[!is.na(over(pts, geometry(ply))),] The thing to note is that there is a geometry method that drops attributes: over changes behaviour if its second argument has ...


3

I played with assign(), ls(), and mget() to accomplish something that I believe will improve your workflow. First I use ls() to get a list of all environment variables that start with "p": names_poly <- ls(pattern='^p.') I used combn() to find all the unique combinations of polygons combos <- combn(names_poly,2) I looped over combos using get() ...


3

I wanted to point out that you can rewrite the mean function, mean, which you can write yourself to do anything you want, including ditch the 0 values and calculate the mean. For example, if you want to ignore 0s: meanIgnoringZeroes <- function(x) { mean(x[x!=0],na.rm=T) } Then you can pass the function, meanIgnoringZeroes to overlay: mean <- ...


3

Take a look at the raster function in the raster package. It will let you create a raster with a specified extent, number of rows/columns and resolution. Here I will use characteristics of your data summary to create a 100x100 raster within the specified extent. I am passing an extent object to define the x and y limits. You can also use the specific ...


3

To do this I would use two tools: Intersect (Analysis): Computes a geometric intersection of the input features. Features or portions of features which overlap in all layers and/or feature classes will be written to the output feature class. then Summary Statistics (Analysis) Calculates summary statistics for field(s) in a table.


3

Intersect, identity and union are the three main overlay functions that could be used in this instance. For the simplest case how many square metres (feet, inches, miles..) of LiDAR coverage are in each county?: Using Intersect overlay the LiDAR coverage over the counties shape file, calculate the areas to a field and then summarize with Summary ...


3

I am not aware of any settings that would allow you to select only the top polygons because when you click on the small polygon, you also click on the underlying polygon. Workarounds: Copy top polygons (if there is a way to differentiate them either by attribute or by size) into a new layer and then make your "large polygons" layers non-selectable. Work ...


3

Zonal Statistics as Table (Spatial Analyst) should work for you. In your case, the range will be represented by the min/max values within the table.


3

Here you were thoroughly answered on how to add your basemap (first map) in QGIS What you need to do next is called georeferencing. Go to plugins and make sure that Georeferencer GDAL is on menu Raster\Georeferencer add your second map add at least 6 points from your second map getting coordinates for each from your first map (also feel free to add more ...


2

Here's an idea, based on using Feature To Line. With ESRI, the tool is only available at the ArcInfo/Advanced license level, but with QGIS I'm sure you can find an version of it. So you could, as I often do, supplement your ArcView/Basic license workflow with free QGIS tools. Run Feature To Line to convert the lake features to lines (make sure you're ...


2

This is imo a great question. If you would be interested in just finding the intersection between two polygons, you'd use the Intersect GP tool and then adding the area of the resultant features back to the wetlands. But you are interested not in intersection yet essentially in the edge, or a segment which polygons share. There is a very nice GP tool in ...


2

1) The easiest solution is to use the processing module in the QGIS Python console: import processing processing.runalg("qgis:joinattributesbylocation","BKMapPLUTO.shp","DCP_nyc_freshzoning.shp","['intersects']",0,"sum,mean,min,max,median",0,'result.shp') 2) Without a GIS, you can use Fiona (read and write shapefiles as Python dictionaries) and Shapely ...


2

You can: Create your own solution with Leaflet http://leafletjs.com/ and one of the plugins from a list below http://leafletjs.com/plugins.html#overlay-data Use http://umap.openstreetmap.fr/ with external data overlay. Check layers. It's not as easy as paste a link into google map search, but much more power-full. Yuo could upload your data or use a link ...


2

You cannot have R objects called "2000", so presumably these are fake names? Your example actually should work, so you may want to double check why you think that the results are incorrect. @aaryno's approach should work. I would do this: library(raster) s <- stack(r2000, r2001, r2002, r2003, r2004, r2005) x <- reclassify(s, cbind(0, NA)) r <- ...


2

There are two possible approaches to the problem, using Intersect or Union. First it would be helpful to understand what the Overlay options you mention actually do. Intersect only returns areas of overlap, Union returns all areas from both layers. It is further worth noting that in ArcGIS you are limited to two input layers per operation unless you have an ...


2

Two ways: use select by location or intersect. Good tutorials on ESRI's site in the hyperlinks, so I won't give instructions here.


2

Perhaps you need to first look at how ifelse works. I get the same results when I use it "stand-alone" and within a call to raster::overlay. a <- rep(2, 5) b <- rep(1, 5) d <- c(2, NA, 2, NA, 2) library(raster) r <- raster(nrow=1, ncol=5) A <- setValues(r, a) B <- setValues(r, b) D <- setValues(r, d) s <- stack(A,B,D) ifelse(a==2 ...


2

I got the tiles to overlay correctly. The problem was in the re-projection done by both ArcMap and QGIS. When I was checking the reprojected shapefiles in ArcMap and QGIS, they were overlaying correctly and had the correct SRIDs. So I imported the shapefiles in WGS84 in PostgreSQL using the SRID4326 with shp2pgsql then used ST_Transfrom to reproject the ...


1

Also, my original question had also asked how to do this in QGIS, but somebody came and removed that for some reason ... for people who are interested in doing this using QGIS, I found how to do this from this Stack Overflow post: Selecting features within polygon from another layer using QGIS? You can use the "Vector->Research tools->Select by Location" ...


1

It's possible but not trivial. A way to do it is to subclass L.TileLayer in such a way that each tile is wrapped in a <canvas> (like https://github.com/aparshin/leaflet-boundary-canvas/blob/master/src/BoundaryCanvas.js#L244 does), then attaching events to the canvases to fetch the pixel value of a given pixel. You might also run into CORS issues when ...


1

If i got you, your question itself is answering the question. You used A∩B i.e. Intersection symbols so use intersection analysis to separate out common areas, for A∩B run intersection between A and B, for A∩B∩C run intersection between A, B and C- mind intersection operation input can be multiple.Documentation is at here.


1

Depending on whether you want a mean or a spatially weighted mean there are a couple things you can do using the rgeos and raster packages library(rgeos) proj4string(grid) <- proj4string(nuts) # I assumed these were the same projection? First find out which grid cells intersect your NUTS polygons grid_nuts <- gIntersects(grid,nuts,byid = TRUE) ...


1

If I understand your desired outcome correctly, you would like a count (richness) of species for each grid cell in the defined raster. I cannot speak to the differences between R and QGIS but I came up with a much more optimized and faster way to conduct your analysis. I leverage the raster package and use a raster stack to accumulate species. The workflow ...


1

A simple "ifelse" statement should suffice in evaluating a condition. Here we create two random vectors of [1,2] and apply an ifelse to evaluate the condition of if x = 2 and y = 1 THEN change (1) ELSE no change (0). ( x <- round(runif(10, 1, 2)) ) ( y <- round(runif(10, 1, 2)) ) ifelse( x == 2 & y == 1, 1, 0) Since this is just an ...


1

Somehow, you have to create an offset between the markers to the user be able to click on each. My suggestion is to listen pointermove event and show the markers separately. I was facing with this same issue and here is my solution. UPDATE So, based on comments. My idea is: create an array attribute of the features id at the same location. On click check ...


1

Try: var html = feature.get('address'); html += feature.get('name'); html += feature.get('whatever'); content.innerHTML = html; popup.setPosition(coord); UPDATE: If you want some markup in the popup: var html = '<h3>Here is ' + feature.get('name') + '</h3>'; html += 'And if you need some <button id="" onclick="">click</button>'; ...


1

So there it is, your fiddle forked and merged. You get rid of jquery popover and implement Openlayers popup: content.innerHTML = feature.get('name'); popup.setPosition(coord);


1

That depends on the values you are attempting to calculate, and the relationship between the two layers boundaries (how coincident they are). Since it sounds like they're numeric values, a spatial join is probably not the way to go. Also note that the right-click join method doesn't give you full control over a spatial join as the GP tool does. I'm not ...


1

I guess your dataset about population density is the GEOSTAT grid dataset from Eurostat. I have already worked with it so I can give you the main steps. First, your GEOSTAT dataset should come with a shapefile (for me, it's called Grid_ETRS89_...). You have to import in QGIS both this shapefile and the .csv file that contains the population data. Then, you ...



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