10

Why not work globally ? calculate the distances between all points union the resulting lines pointx - pointy with a distance < 14m I will use Shapely, much easier for resolving these kinds of problems. You must iterate through all pairs of points to calculate the distance once (as distance point1-point2 = distance point2-point1). There are many ...


10

I modified the original code a little bit to avoid some confusion when defining the RasterCenter function, since the argument named raster used in def RasterCenter(raster) and the variable named raster used in raster = arcpy.Raster(raster) within the function can cause confusion and make things not working properly. I modified parsing the path when reading ...


10

As GDAL supports writing to X,Y,Z (CSV) ascii, you could use gdal_translate: gdal_translate -of xyz -co ADD_HEADER_LINE=YES -co COLUMN_SEPARATOR="," input_raster output.csv To avoid writing NoData values to your output you can write the output to stdout then pipe to grep/findstr to filter it before writing to your csv: gdal_translate -q -of xyz -co ...


8

If you want only the extent of one image and not the full directory you can go to Vector->Research Tool->Polygon from layer extent here select the image you want the extent and save the output.


8

If you look at the example on the man page for ST_PixelAsPolygons you will see how you can access the geometries using table_alias.geom syntax (similar in spirit to how ST_Dump works to turn a set or records into individual rows). Following on from that example, you can pass (gv).geom to the ST_AsGeoJSON function, eg, SELECT ST_AsGeoJSON((gv).geom) FROM ...


8

Not automatization (strictly speaking), but one good helper tool would be Gimp Selection Feature plugin. It enables us to access Fuzzy selection tool of Gimp 2.10, and returns a polygon layer taken from the area you have chosen. When I tested it on your posted image, Threshold value set at 60.0 was good at differentiating the blue river and surrounding ...


7

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


7

Try using rasterio, which uses GDALFPolygonize on float arrays. import numpy as np import rasterio.features from affine import Affine from shapely.geometry import shape # triangular array ar = np.tri(5, dtype='f') print(ar) for shp, val in rasterio.features.shapes(ar, transform=Affine(1, 0, 0, 0, -1, 5)): print('%s: %s' % (val, shape(shp))) shows:...


7

GRASS GIS is able do this. You need two steps: r.thin Thins non-null cells that denote linear features in a raster map layer. r.to.vect Converts a raster map into a vector map.


6

You can't use GDALFPolygonize with the GDAL python bindings without modifying the source code and recompiling as it isn't exposed in the GDAL swig interface. Note: as at Feb 2016, GDALFPolygonize IS exposed in the GDAL SVN trunk source, but is not in either of the latest releases (1.11.4/2.0.2). To polygonize your raster, you will need to convert from ...


6

I came across a thread Smoothing a 2-D figure. The answers make reference to this paper Chaikin's algorithm for curves For a given polygon with vertices as P0, P1, ...P(N-1), the corner cutting algorithm will generate 2 new vertices for each line segment defined by P(i) and P(i+1) as Q(i) = (3/4)P(i) + (1/4)P(i+1) R(i) = (1/4)P(i) + (3/4)P(i+1) So, your new ...


6

As previously commented, you may accomplish all your task using R exclusively; in the following code, a raster is created and then filtered to values above the threshold, all other values will become NA, then the pixels are masked to the lines. Raster works now in recent versions with both sf and sp objects, the code uses the latter kind. library(raster) r &...


5

As mentioned in the comments by @Knightshound, you seem to lack some experience in GIS. Still, i'm going to answer your question so you get some of this experience you need. What you want to do is Polygonize, in the Raster menu/Conversion/Polygonize (Raster to Vector), but you'll quickly realize it doesn't produce what you expect ;)


5

ArcGIS has a Raster to Polygon tool that will do this for you. It's in the conversion toolbox. I suspect there's a better way to approach your problem, but it's hard to say without knowing more about your analysis.


4

Try this way with GDAL: import os, sys from osgeo import gdal from osgeo import gdalconst # get the arguments InRaster = sys.argv[1] OutCSV = sys.argv[2] # open the raster and get some properties ds = gdal.OpenShared(InRaster,gdalconst.GA_ReadOnly) GeoTrans = ds.GetGeoTransform() ColRange = range(ds.RasterXSize) RowRange = range(ds.RasterYSize) ...


4

Rather than converting that image to vector, you should get the OpenStreetMap data from Mapzen: https://mapzen.com/data/metro-extracts/metro/kolkata_india/ Bring that into QGIS and check out what data is there, and then start to style it as your raster map is styled.


4

Now it worked for me as @RoVo suggested before. The problem were the no-data values in my input raster. I changed these not with gdal_translate as @AndreJ suggests (in comments of answer above), but with GRASS r.mapcalc. Here the modules that I used: Replace all no data values: processing.runalg('grass:r.mapcalculator', {"amap": ...


4

I found a solution using USGS landcover dataset and gdal_sieve . The raw dataset looks like this: And using gdal_sieve led to that: Which is exactly what I wanted :) . Now I "just" have to choose pretty colours.


4

Your question is very broad but try some kind of segmentation, for example GRASS i.segment. Your raster is probably to high resolution. I tried with 1 m and 5 m: i.segment Vectorize Convert to lines Simplify The combination of input parameters are infinite.


4

Use the "Raster pixels to polygons" tool. It will convert the floating point values correctly.


3

According to the docs thinning is for line features. Remember to select "area" as the feature type in r.to.vect.


3

Why don't you crop again with your clipper after vectorizing? That way any combined polygons derived from your raster layer will match your original clipping layer. If you don't want to add an extra step you can vectorize the entire raster layer then clip to vector layer (though this could take more computation time). Any other option I can think of would ...


3

The final batch file, based on Logan Byers answer, which I managed to get working on a Windows machine. I should note that I had to amend the output of gdal2xyz.py. For some reason the version I had (installed with FWTools 2.4.7) would not accept the -csv option as valid syntax and you can see it is omitted from the code below. I had to open the gdal2xyz....


3

The data was in float, so I found after some research it needs to be converted into integer first. Using Raster Calculator I used the following syntax to convert into new raster layer. It created an attribute table and I can convert it into vector data now. Syntax: Int("surface_temp.img") `


3

The algorithm is trying to create polygon geometries for each elevation value. The common case is that there are many single pixels that must be transformed into polygons with the size of the pixel. Also, adjacent and edge pixels may form invalid geometries. In general, a polygonization of a DEM is not what we want, and usually the solution is to ...


3

To complement the comment above, there is a number of ways that you may want to tackle this issue - most can be run from within QGIS. As mentioned above, the GRASS GIS tool i.segment is a very powerful tool. In addition, another option is the segmentation tools (e.g. otbcli_Segmentation) available in the Orfeo Toolbox, which are described in detail here. ...


3

The following solution assumes that you have a GeoTiff with raster values, which you want to filter based on a threshold (e.g. 50) and convert the resulting pixels to an ESRI Shapefile for later use. ##load libraries library(raster) library(rgdal) #read in raster inputimage <- raster('input_raster.tif') ##check the image in R plot(inputimage) ##mask ...


3

You can use Menu Raster / Converstion / Vectorize raster layer (screenshot 1). On the output layer, apply Select Features by Expression… and insert "DN" = 0 to the expression editor (screenshot 2), thus selecting all polygons where the raster value is 0: these are the ones you want to delete. Now delete the selected features and you are left just ...


2

Using the majority filter with a kernel of 5 by 5 pixels gives the best results for me.


2

The Esri FLT data format stores its data identically to an Esri BIL file, which GDAL does support: GDAL_Translate -of EHdr -ot Float32 .... Then all you need to do is change the extension from bil to flt and edit the header - the keywords are different.. for example: BYTEORDER I LAYOUT BIL NROWS 1004 NCOLS 1002 NBANDS ...


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