v.to.rast is letting me know that it does not accept text columns in an
attribute table. Has anyone figured out a simple approach to making this
work? I suppose that I could import the data into R, convert to factors, save
the levels back to the table and use those... but there may be something out
there that is simpler and can be done within GRASS. Also, would this be
something worth adding to the v.to.rast code?
Try to make unique numbers from your string-column and convert them with
column=... and labelcolumn...
Achim
Dylan Beaudette schrieb:
Hi,
v.to.rast is letting me know that it does not accept text columns in an
attribute table. Has anyone figured out a simple approach to making this
work? I suppose that I could import the data into R, convert to factors, save
the levels back to the table and use those... but there may be something out
there that is simpler and can be done within GRASS. Also, would this be
something worth adding to the v.to.rast code?
Try to make unique numbers from your string-column and
convert them with
column=... and labelcolumn...
Achim
Dylan Beaudette schrieb:
> Hi,
>
> v.to.rast is letting me know that it does not accept
text columns in an
> attribute table. Has anyone figured out a simple
approach to making this
> work? I suppose that I could import the data into R,
convert to factors, save
> the levels back to the table and use those... but
there may be something out
> there that is simpler and can be done within GRASS.
Also, would this be
> something worth adding to the v.to.rast code?
>
> Cheers,
> Dylan
Try to make unique numbers from your string-column and
convert them with
column=... and labelcolumn...
Achim
Dylan Beaudette schrieb:
> Hi,
>
> v.to.rast is letting me know that it does not accept
text columns in an
> attribute table. Has anyone figured out a simple
approach to making this
> work? I suppose that I could import the data into R,
convert to factors, save
> the levels back to the table and use those... but
there may be something out
> there that is simpler and can be done within GRASS.
Also, would this be
> something worth adding to the v.to.rast code?
>
> Cheers,
> Dylan
Great! Thanks for the tips. I was able to accomplish this (in PostGresql) with
the following steps:
1. generate unique list of text categories as a temp table
2. add a serial column to the temp table (auto-incrementing integer)
3. add new column to original table
4. UPDATE original table with the new serial number, assigned by text category
5. v.to.rast
Cheers,
Dylan
On Wednesday 14 October 2009, Markus Neteler wrote:
IMHO ticket 175 has been fixed. I can now run (thanks to Martin):
As Achim says: col must be numerical and should be the numerical
representation of the text attributes (see example above).
Markus
On Wed, Oct 14, 2009 at 1:39 PM, Hamish <hamish_b@yahoo.com> wrote:
> see also https://trac.osgeo.org/grass/ticket/175
>
> Achim wrote:
>> v.to.rast has the option:
>>
>> --%<--
>> labelcolumn=name
>> Name of column used as raster category
>> labels
>> --%<--
>>
>> And the raster values have to be numeric:
>>
>> --%<--
>> column=name
>> Name of column for attr parameter (data type
>> must be numeric)
>> --%<--
>>
>> (http://grass.itc.it/grass64/manuals/html64_user/v.to.rast.html)
>>
>> Try to make unique numbers from your string-column and
>> convert them with
>> column=... and labelcolumn...
>>
>> Achim
>>
>> Dylan Beaudette schrieb:
>> > Hi,
>> >
>> > v.to.rast is letting me know that it does not accept
>>
>> text columns in an
>>
>> > attribute table. Has anyone figured out a simple
>>
>> approach to making this
>>
>> > work? I suppose that I could import the data into R,
>>
>> convert to factors, save
>>
>> > the levels back to the table and use those... but
>>
>> there may be something out
>>
>> > there that is simpler and can be done within GRASS.
>>
>> Also, would this be
>>
>> > something worth adding to the v.to.rast code?
>> >
>> > Cheers,
>> > Dylan
>
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
On Wednesday 14 October 2009, Dylan Beaudette wrote:
Great! Thanks for the tips. I was able to accomplish this (in PostGresql)
with the following steps:
1. generate unique list of text categories as a temp table
2. add a serial column to the temp table (auto-incrementing integer)
3. add new column to original table
4. UPDATE original table with the new serial number, assigned by text
category 5. v.to.rast
Cheers,
Dylan
One small note-- I noticed that the operation takes MUCH longer to complete
when the labelcolumn argument is specified. So long in fact, that I canceled
the process, and converted only the integer representation to raster. I then
added the category labels with r.category. Something in v.to.rast was causing
the postgresql instance to peg the CPU at 100% when specifying a labelcolumn.
This was for a rather large vector conversion, about 410520 features.
Cheers,
Dylan
On Wednesday 14 October 2009, Markus Neteler wrote:
> IMHO ticket 175 has been fixed. I can now run (thanks to Martin):
>
> v.db.select lsat7_training
> cat|name|id
> 1|water|1
> 3|forest|2
> 4|forest|2
> 5|asphalt|3
> 6|asphalt|3
> 7|water|1
> ...
> v.to.rast in=lsat7_training out=lsat7_training use=attr col=id
> labelcol=name
>
> As Achim says: col must be numerical and should be the numerical
> representation of the text attributes (see example above).
>
> Markus
>
> On Wed, Oct 14, 2009 at 1:39 PM, Hamish <hamish_b@yahoo.com> wrote:
> > see also https://trac.osgeo.org/grass/ticket/175
> >
> > Achim wrote:
> >> v.to.rast has the option:
> >>
> >> --%<--
> >> labelcolumn=name
> >> Name of column used as raster category
> >> labels
> >> --%<--
> >>
> >> And the raster values have to be numeric:
> >>
> >> --%<--
> >> column=name
> >> Name of column for attr parameter (data type
> >> must be numeric)
> >> --%<--
> >>
> >> (http://grass.itc.it/grass64/manuals/html64_user/v.to.rast.html)
> >>
> >> Try to make unique numbers from your string-column and
> >> convert them with
> >> column=... and labelcolumn...
> >>
> >> Achim
> >>
> >> Dylan Beaudette schrieb:
> >> > Hi,
> >> >
> >> > v.to.rast is letting me know that it does not accept
> >>
> >> text columns in an
> >>
> >> > attribute table. Has anyone figured out a simple
> >>
> >> approach to making this
> >>
> >> > work? I suppose that I could import the data into R,
> >>
> >> convert to factors, save
> >>
> >> > the levels back to the table and use those... but
> >>
> >> there may be something out
> >>
> >> > there that is simpler and can be done within GRASS.
> >>
> >> Also, would this be
> >>
> >> > something worth adding to the v.to.rast code?
> >> >
> >> > Cheers,
> >> > Dylan
> >
> > _______________________________________________
> > grass-user mailing list
> > grass-user@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/grass-user
One small note-- I noticed that the operation takes MUCH
longer to complete when the labelcolumn argument is specified.
...
Something in v.to.rast was causing the postgresql instance to peg
the CPU at 100% when specifying a labelcolumn.
This was for a rather large vector conversion, about 410520
features.
a wild guess would be that it is opening and closing the DB connection
for each feature or similar.
maybe I am missing something, but why not just do: "v.to.rast use=cat
labelcolumn=name" ?