[GRASS-user] Problem using allpairs for spatial analysis

Markus Metz markus.metz.giswork at gmail.com
Thu Apr 4 00:33:35 PDT 2013


On Wed, Apr 3, 2013 at 10:43 PM, דור פרידמן <dof1985 at gmail.com> wrote:
> Hello all,
>
> I'm trying to calculate a matrix of all shortest paths from settlements to 3
> types of waste treatment facilities.
>
> My methodology is to use the following layers:
> 1. roads - lines.
> 2. poi - points (combination of 3 layers as follows):
>
> I used 3 distinct layers - landfill sites, recycling sites and sites which
> preforms both landfilling and recycling. I combined them to one layer called
> poi and uses v.db.update to change the categories of each layer.

v.db.update does not change categories, it only changes attributes.
You need to use v.category or v.reclass to change categories.
See also the GRASS vector intro:
http://grass.osgeo.org/grass70/manuals/vectorintro.html

> The reason
> for this is that those 3 layers was extracted out of one "sites" layer and
> their cats are messed up. I need to separate them since I would like to
> analyze each distance matrix separately.
>
> I changed the cats by summing 10000 + cat, 20000 + cat and so on,

You changed attributes, not categories. You can check with v.category op=report.

> for each
> type of site, including the settlements. Afterwards I plan to filter and
> extract from this layer the following maps:
>
> allpairs - settlements to landfill, settlements to recycling and settlements
> to both. Than I'll use excel to add gate fees to transportation costs and to
> find the cheapest route from each settlement to one site in each category.
>
> The problem is that after doing allpairs, I have received in both from and
> to cat the original cats and not those that I changed with v.db.update.
>
> i.e. before all pairs poi cats would look something like that:
>
> cat = 10133, name, type=1
> cat = 40121, name, type=4
>
> after allpairs it became something like that:
> cat=1, from_cat=133, to_cat=121 and so on...
>
> How can it be fixed?

1. Create a new column of type integer, named new_cat or similar.
2. Populate the new column with the desired new category values.
3. Reclassify the vector map with v.reclass using the column with the
desired new categories.

HTH,

Markus M


More information about the grass-user mailing list