[GRASS-user] v.dissolve bugfeature / workaround needed

Daniel Victoria daniel.victoria at gmail.com
Wed Aug 6 19:52:46 EDT 2008


There is a long tread about this...

http://thread.gmane.org/gmane.comp.gis.grass.user/21875/focus=21887

In the end I was under the impression that v.dissolve did work with
string data, as Hamish wrote:
http://article.gmane.org/gmane.comp.gis.grass.user/21920

But, I'm not sure if the column has to be type varchar or something else?

Anyway, if you are using dbf database, just open it in openoffice
(calc or base) and add a neu integer column with the values you want
for dissolve

cheers
daniel

On Wed, Aug 6, 2008 at 1:40 PM, Milton Cezar Ribeiro
<miltinho.astronauta at gmail.com> wrote:
> Hi Peter,
>
> Following Morit´z suggestion, how about you use R on this task?
>
>
> #The code below is to you read your dbf file
> #so remove the # and include your full path/file name
> #require(foreign)
> #my.dbf<-read.dbf("c:/temp/myfile.dbf") #
>
> #below we simulate a data.frame (it is a table)
>
> my.dbf<-data.frame(cbind(var1=c("GRASS001","GRASS002","GRASS003")))
> my.dbf
>
> #below you have a code to "deparse" your variable of interest
>
> my.dbf$var2_char<-substr(my.dbf$var1,6,999)
> my.dbf
>
> my.dbf$var2_int <-as.numeric(as.character(my.dbf$var2_char))
> my.dbf
>
>
>
> Cheers,
>
>
>
> miltinho
>
> brazil
>
>
>
> 2008/8/6, Moritz Lennert <mlennert at club.worldonline.be>:
>>
>> On 06/08/08 15:09, peter.loewe at gmx.de wrote:
>>>
>>> Hello list,
>>>
>>> i am using GRASS 6.4svn to merge adjacent poylgons into larger units.
>>> The merging is controlled by a column of type CHAR:
>>>
>>> v.dissolve input=counties output=counties_merged_fips1 column=FIPS_1
>>>
>>>
>>> results in dbmi: Protocol error ERROR: Cannot open select cursor:
>>> SELECT cat, FIPS_1 FROM counties ORDER BY FIPS_1 ERROR: Unable to
>>> open vector map <counties_fips1_22157 at admin_borders> on topology
>>> level 2 WARNING: Table <counties_fips1_22157> linked to vector map
>>> <counties_fips1_22157> does not exist ERROR: Vector map
>>> <counties_fips1> not found in the current mapset
>>>
>>> v.dissolve works correctly when applied to an INT column.
>>>
>>> I assume this is a bugfeature -
>>
>> v.dissolve is only a frontend script to v.reclass which needs ints...
>>
>>> string-based dissolving would be
>>> great to have at some point.
>>
>> +1
>>
>>>
>>> For now, does anybody have a (DBdriver-)SQL-hack to transmogrify
>>> strings like "GRASS001", "GRASS002", "GRASS003" into the Integers
>>> 1,2,3 ? (aka getting rid of the "GRASS"-part of the string) ?
>>
>> If you absolutely need to work with the dbf-driver, then I guess you best
>> bet would be to open the dbf file in OpenOffice Calc and use its functions.
>>
>> If you can switch over to SQLite, I think the ltrim function should do
>> what you need.
>>
>> More full-fledged SQL-backends obviously have more sophisticated
>> functions.
>>
>> Moritz
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>


More information about the grass-user mailing list