Code Monkey home page Code Monkey logo

Comments (13)

ecodiv avatar ecodiv commented on June 2, 2024 2

The difference with what I tried is that here you want to dissolve line features, right?

@ecodiv yes, right! And v.extract doesn't support aggregation by specific columns. So my task can't be done with GRASS.

@geografin I think it can be used, see #3433

from grass.

ecodiv avatar ecodiv commented on June 2, 2024

@geografin I can't reproduce the problem on GRASS 8.4.0 on Ubuntu 22.04, using aggregate_backend=sql.

from grass.

wenzeslaus avatar wenzeslaus commented on June 2, 2024

Thanks for reporting this. Can you please provide the code to reproduce ideally using the NC SPM sample dataset or other public data? The code can be just copied commands from the GUI if you are using it (there is Copy button in the tool dialog).

from grass.

geografin avatar geografin commented on June 2, 2024

v.dissolve input=over_geo column=subid aggregate_columns=a_length,a_source_elev,a_outlet_elev aggregate_methods=sum,max,min result_columns=LENGTH,SOURCE,OUTLET output=over_geo_diss --overwrite
This is the command that ends with error. The map taken is a simple rivers layers generated with r.stream.order and overlayed with subwatersheds vector with v.overlay.

from grass.

geografin avatar geografin commented on June 2, 2024

I don't use GUI. I use bash linux with GRASS docker image (from main branch, the last one)

from grass.

wenzeslaus avatar wenzeslaus commented on June 2, 2024

Sorry @geografin what I meant was a minimal reproducible example. @ecodiv was not able to reproduce it, so I'm looking for a way to get the same data and situation you have. Bash is definitively better starting point than GUI, so that's great. Can you try to run relevant commands with the NC SPM sample dataset and share these commands?

from grass.

geografin avatar geografin commented on June 2, 2024

Well. So take NorthCarolina dataset (full) and reproduce (I copy some maps form the dataset, that are identical to mine by type):

g.copy vect=roadsmajor,streams_init --overwrite
g.copy vect=zipcodes_wake,geodata_subbasins --overwrite
v.overlay ainput=streams_init binput=geodata_subbasins operator=and atype=line output=over_geo --overwrite
v.db.addcolumn map=over_geo columns="subid VARCHAR(15),maindown VARCHAR(15)"
v.db.update map=over_geo column=subid query_column="CAST(b_ZIPCODE_ID AS varchar)" where="b_ZIPCODE_ID <> 'N/A'"
v.dissolve input=over_geo column=subid aggregate_columns=a_SHAPE_LEN aggregate_methods=sum result_columns=LENGTH output=over_geo_diss --overwrite --verbose

This results in error:

ERROR: There is no table connected to <over_geo_diss>. Run v.db.connect or
       v.db.addtable first.
ERROR: A processing step failed. Check the above error messages and see the
       following details:
       Module run `v.db.addcolumn map=over_geo_diss layer=1 columns=LENGTH
       DOUBLE` ended with an error.
       The subprocess ended with a non-zero return code: 1. See errors
       above the traceback or in the error output.

That is the error I am talking about. Use --verbose flag in the last command to see that the error is caused by v.reclass which creates a new database table.

from grass.

ecodiv avatar ecodiv commented on June 2, 2024

@geografin I can confirm the example results in the reported error. The difference with what I tried is that here you want to dissolve line features, right?

@wenzeslaus The manual exclusively refers to polygon data. Is this function supposed to be able to dissolve line features?

from grass.

wenzeslaus avatar wenzeslaus commented on June 2, 2024

...Is this function supposed to be able to dissolve line features?

Thanks for looking into this. I didn't dive into that and focused on the attribute aggregation, so I don't know from top of my head. The geometrical part is taken care of by v.reclass and v.extract, so you can check those. The lines in v.dissolve are:

            gs.run_command(
                "v.reclass",
                input=input_vector,
                output=tmpfile,
                layer=layer,
                column=column,
            )
            gs.run_command(
                "v.extract",
                flags="d",
                input=tmpfile,
                output=output,
                type="area",
                layer=layer,
            )

from grass.

ecodiv avatar ecodiv commented on June 2, 2024

...Is this function supposed to be able to dissolve line features?

Thanks for looking into this. I didn't dive into that and focused on the attribute aggregation, so I don't know from top of my head. The geometrical part is taken care of by v.reclass and v.extract, so you can check those. The lines in v.dissolve are:

            gs.run_command(
                "v.reclass",
                input=input_vector,
                output=tmpfile,
                layer=layer,
                column=column,
            )
            gs.run_command(
                "v.extract",
                flags="d",
                input=tmpfile,
                output=output,
                type="area",
                layer=layer,
            )

Without having tested it, the type="area" might be the problem?

from grass.

wenzeslaus avatar wenzeslaus commented on June 2, 2024

Without having tested it, the type="area" might be the problem?

Haha, that sure looks like that! Maybe deleting it will do trick?

from grass.

geografin avatar geografin commented on June 2, 2024

The difference with what I tried is that here you want to dissolve line features, right?

@ecodiv yes, right! And v.extract doesn't support aggregation by specific columns. So my task can't be done with GRASS.

from grass.

wenzeslaus avatar wenzeslaus commented on June 2, 2024

#3433 will be merged in following hours when the CI is done testing it. Thanks @ecodiv for the update!

from grass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.