1

Here is my question. I have a bunch of polyline shows like:

http://i4.tietuku.com/bc378d1cd2c24142.png

I want to generater raster data based on the polyline which contain the length of the line in one grid.

For example:

  1. original data
    http://i4.tietuku.com/8b8768aac183cfe6.png

  2. Aim

http://i4.tietuku.com/a09ba42a122f561a.png

===== Add ====

Found the answer using ArcGIS from this

using R from this

My target is convert the polyline into raster using Python
with some open-source modules(gdal, fiona, etc)

Community
  • 1
  • 1
Han Zhengzu
  • 3,694
  • 7
  • 44
  • 94
  • 1
    This is best directed here http://gis.stackexchange.com/ but in any event a featureclass can only contain one geometry type so if you have points, polylines and polygons, you will have to treat them separately. In your example, you show a closed-loop polyline instead of a polygon. It will not produce the enclosed area that you desire unless you convert it to a polygon first. You should specify what software you have access to as well, particularly if this is GIS related –  Dec 29 '15 at 13:53
  • Thanks for your reply. I just want to using python with some module to get the work done. The example I showed may be confusing. For now, I want to transfer the polyline( which represent the road networks) into the raster data – Han Zhengzu Dec 29 '15 at 14:05
  • For now, I can use [shapely](https://pypi.python.org/pypi/Shapely) to get the interaction of the road and my made-up grid. But the loop all over the space cost so much time. So, I'm working on generate the grid along the road(I have already used K-d tree algorithm to locate the start grid and end grid of one polyline) – Han Zhengzu Dec 29 '15 at 14:13
  • 1
    Your options are `gdal.RasterizeLayers` or `rasterio.features.rasterize`. Both work really well for rasterizing vector data. – Mike T Jan 10 '16 at 23:14

0 Answers0