Discussion:
[Qgis-user] Centre of the roads from polygons to lines
Matej Mailing
2012-06-02 08:02:12 UTC
Permalink
Hi,

I have a layer that contains roads in polygons and I need to get
central lines of the polygons. When I convert directly from polygons
to lines, I get two lines for each part of the road representing road
"boundaries" which isn't good.

What is the best way to achieve it?

Thanks,
Matej
Micha Silver
2012-06-03 06:40:35 UTC
Permalink
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120603/752f9868/attachment.html>
Matej Mailing
2012-06-03 09:32:24 UTC
Permalink
Hi,

thanks, will try this one. There are many attributes and losing them
or re-setting them is a very painful process.

I was playing with different plugins and trying to use polygon
centroids and then connecting them with lines, but had problems with
it since it seems that gid values are not different by 1 for
neighbouring nodes and then the point-to-line conversion is wrong.
Perhaps some sort of a functionality to correctly connect polygon
centroids with a line would be most welcome and I am sure it could
also be used in some other cases.

Thanks,
Matej
Post by Matej Mailing
Hi,
I have a layer that contains roads in polygons and I need to get
central lines of the polygons. When I convert directly from polygons
to lines, I get two lines for each part of the road representing road
"boundaries" which isn't good.
There's a procedure using GRASS that you might choose. It involves
converting the polygons to a GRASS raster, then running the GRASS module
r.thin, and then converting back to a vector.
http://www.mail-archive.com/grass-user at lists.osgeo.org/msg01015.html
* you have to set the resolution fairly high in order to keep the road's
shapes, but then the raster might be too large to work with on a large area
* and you loose the attribute table on the way...
What is the best way to achieve it?
Thanks,
Matej
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
This mail was received via Mail-SeCure System.
--
Micha Silver
052-3665918
Paulo van Breugel
2012-06-03 10:27:20 UTC
Permalink
Just as a follow up on the idea by Misha. It wouldn't be too difficult
to add a column with a unique integer value to the polygons. Then,
follow Misha's idea, making sure that you use the newly created column
as the raster values. After you have converted the raster back to a line
vector layer, reconnect the attribute table using the unique integers
you created.
Post by Matej Mailing
Hi,
thanks, will try this one. There are many attributes and losing them
or re-setting them is a very painful process.
I was playing with different plugins and trying to use polygon
centroids and then connecting them with lines, but had problems with
it since it seems that gid values are not different by 1 for
neighbouring nodes and then the point-to-line conversion is wrong.
Perhaps some sort of a functionality to correctly connect polygon
centroids with a line would be most welcome and I am sure it could
also be used in some other cases.
Thanks,
Matej
Post by Matej Mailing
Hi,
I have a layer that contains roads in polygons and I need to get
central lines of the polygons. When I convert directly from polygons
to lines, I get two lines for each part of the road representing road
"boundaries" which isn't good.
There's a procedure using GRASS that you might choose. It involves
converting the polygons to a GRASS raster, then running the GRASS module
r.thin, and then converting back to a vector.
http://www.mail-archive.com/grass-user at lists.osgeo.org/msg01015.html
* you have to set the resolution fairly high in order to keep the road's
shapes, but then the raster might be too large to work with on a large area
* and you loose the attribute table on the way...
What is the best way to achieve it?
Thanks,
Matej
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
This mail was received via Mail-SeCure System.
--
Micha Silver
052-3665918
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120603/f3dbd574/attachment-0001.html>
Jukka Rahkonen
2012-06-04 07:32:19 UTC
Permalink
Post by Matej Mailing
Hi,
I have a layer that contains roads in polygons and I need to get
central lines of the polygons. When I convert directly from polygons
to lines, I get two lines for each part of the road representing road
"boundaries" which isn't good.
What is the best way to achieve it?
You may want to have a look at the OpenJUMP skeletonizer plugin, if not else
then just getting some inspiration.
http://sourceforge.net/projects/jump-pilot/files/OpenJUMP_plugins/More%20Plugins/JUMP%20Skeletonizer%20Plugin/

There seems to be an article about skeletonizing with PostGIS
http://ageoguy.blogspot.fi/2010/12/squelettisation.html

-Jukka Rahkonen-

Continue reading on narkive:
Loading...