# Tag Info

## Hot answers tagged vectorization

21

GRASS GIS has a tool to convert raster lines to vector. The procedure is: First open the map in an image editor (GIMP), select by colors with some tolerance and select the black color. Invert selection and delete non-black stuff. Save as Tiff WITH NO COMPRESSION. Then in GRASS: r.in.gdal - import raster r.thin - Thins non-zero cells that denote linear ...

8

Georeference the image and capture by hand. This is by far the best way as it is less prone to error.

8

To simplify the raster it might be worth looking at gdal_sieve, it's available under the "Raster" menu. See: http://www.gdal.org/gdal_sieve.html N.

8

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

8

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

7

If all you have is the jpg, then I would suggest georeferencing the jpg and then manually digitizing the roads/rivers/etc vectors. That will give you the best control over the result, I personally have never had good luck with using raster-vector conversions in a situation like this. Unfortunately, sometimes the best option is to just do it the hard way.

6

Use GRASS with the native GUI or with the QGIS plugin or with the Sextante plugin and use the v.generalize tool, choosing the "Chaikens" algorithm.

6

I haven't used it, but you may want to try the gdal_polygonize script that comes with GDAL http://www.gdal.org/gdal_polygonize.html

6

You can use GDAL tool inside Quantum GIS. Its free and it works fine. Install Quantum GIS and Gdaltools and you'll have a set of tool for raster/image processing. The one you want would be vectorize (gdal_polygonize). Cheers

5

From the point of view of population density, an "urban area" ought generally to satisfy just a few axiomatic criteria: Its boundary should not include any points of (relatively) high density compared to the maximum density within its interior. It should be simply connected (no "holes"). Its average population density should exceed some prespecified ...

5

In answer to my own question, I've written a program to "vectorize" an ArcInfo Grid ASCII files as an ESRI shapefile with a single layer containing oriented polygonal grid squares centered at the points of the grid, with an attribute value equal to the value at the coordinates of the centroid. The program (still under development) is available on GitHub. An ...

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

5

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

5

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

4

I did some work on this for my MSc http://ian01.geog.psu.edu/papers/mscthesis.pdf - basically I worked on gradient changes but the discussion may help you with this.

4

To generalize, try running a majority filter. This is available in saga (and grass as well, check markusN his answer). An explanation for how it works from arcgis: http://edndoc.esri.com/arcobjects/9.2/net/shared/geoprocessing/spatial_analyst_tools/majority_filter.htm

4

I assume that your graphs came from a R-script and that you are capable of using R. Here is a solution in R, which finds local maxima and minima along a data sequence x <- rnorm(50,mean=1500,sd=800) # Example-Data r <- rle(x) # Generate run sequence object min <- which(rep(x = diff(sign(diff(c(-Inf, r\$values, -Inf)))) == 2, times ...

4

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

3

You can first use the "mode" operator of r.neighbors in GRASS GIS (via Sextante plugin), then vectorize with r.to.vect to obtain polygons. Perhaps the "mode" operator should be run more than one time.

3

you can use gdal_polygonize.py for converting raster to vector, if u previously use . some information is here. produces a polygon feature layer from a raster SYNOPSIS gdal_polygonize.py [-o name=value] [-nomask] [-mask filename] raster_file [-b band] [-q] [-f ogr_format] out_file [layer] [fieldname] beside this in qgis ...

3

I doubt there is anything that does exactly what ArcScan does automatically, without introducing multiple steps -- the process is a complex one which requires decisions, so each package will likely take a slightly different approach. That said, GRASS has a tutorial on contour line conversions which should fit the bill, within that guide only a few commands ...

3

If you have ArcGIS you could use the ArcScan extension if you have the license for it.

3

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

3

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

2

Scan2cad has a free set of Image cleanup tools. You can dilate the Pixels to close the gaps, then thin the pixels. Despeckle,etc. Bring the image into ArcGIS, raster to polyline. To find the remaining gaps, save the line end-points as points (feature vertices to points). Run Near, setting a max search distance. Arc 10 has more advanced snapping tools. You ...

2

According to the comments below the question, you want to (a) classify the image into a small number of discrete categories and then (b) convert it into a polygon representation ("vectorize" it). There are many ways to do (a). Good choices in this application are either (a.i) drive the calculations with a reclassification table via the reclassify tools or (...

2

I say you should be very careful when using data like this. You can easily get wrong values since your image, more than the values you want to extract have town names, streets, etc... Even worst, it might be antialiased producing lots of diferent rgb combinations, that would be difficult to reclassify. I would say that the safest way would be manually ...

2

You can only vectorize lines, not continuous fields. Hence use r.mapcalc with a threshold to extract line structures from that map, then subsequently r.thin. Then it will work as expected. See also this Wiki page for more possibilities: http://grass.osgeo.org/wiki/R.stream.*

2

The model below should get you started in the right direction. I used 4-band 1m NAIP imagery as the model input. The imagery below shows the CIR tiff on the left followed by the generalized raster in the middle and the final vector product with four vegetation zones is on the right. Unsupervised maximum likelihood classification was used on the CIR ...

2

There is no need to clean a map to vectorize it. Printed raster maps have resolutions, scales. Editing and redrawing make much sense since you planning create a new map composition using data from another map source. If you do not have the original data used to create the map or if it is old and need be converted to digital format( raster, vector ) then the ...

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