[GRASS-user] v.edit break lines at coordinates

2020-03-13 Thread Johannes Radinger
Hi GRASS users,

maybe someone of you can explain me following problem (of understanding) I
am facing:
I want to break a single line into several. More specifically, I am using
v.edit with the option break and two coordinate pairs to break a single
line. I'd expect that breaking a single line at two points would result in
three lines; However this results in 4 categories?!

Here a small example using the NC dataset:
#
# Extract single line for testing
v.extract --o input=streams@PERMANENT cats=92551 output=selected_stream

# Break line at two point locations and clean (recommended after v.edit
break)
v.edit map=selected_stream tool=break threshold=30
coords='635861,224469,635793,224553'
v.clean --o input=selected_stream output=selected_stream2 tool=rmdupl

# Add categories to layer 2 to check
v.category --o input=selected_stream2 layer=2 output=selected_stream3
option=add
v.db.addtable map=selected_stream3 layer=2
d.vect -c map=selected_stream3@test4 layer=2 label_layer=2
attribute_column=cat


So the display shows three colors which makes sense as these would be the
three lines that I'd expect from breaking a single line at two points. But
there are four categories (that are also listed in the attribute table).
Can anyone explain that to me, what I am doing wrong; or even better, what
would you recommend to do if I want to break a line at two coordinates into
three lines?

Thank you for your help!
Johannes
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] v.in.ogr layer name

2020-03-13 Thread Johannes Radinger
Hi Markus,

On Thu, Mar 12, 2020 at 10:19 PM Markus Metz 
wrote:

>
>
> On Thu, Mar 12, 2020 at 12:43 PM Johannes Radinger <
> johannesradin...@gmail.com> wrote:
> >
> > Hi all,
> > I am using v.in.ogr to import a shape file (line vector) that has only
> one layer. Although I am specifying the output parameter in v.in.ogr the
> layer name of the imported map still remains the original; it is only the
> output map and the associated table that gets a new name as defined by
> 'output'.
> >
> > When checking the connections of that map using v.db.connect:
> > v.db.connect -p map=my_new_map@analysis2
>
> > Vector map  is connected by:
> > layer <1/Watercourse> table  in database
>  through driver  with key 
> >
> > Is that the intended behavior of v.in.ogr that the layer name does not
> get renamed based on the output parameter?
>
> Not sure how much intention is in this behaviour, but the GRASS-internal
> layer name is mostly informative. GRASS vector layers are usually addressed
> by number, not by name. It is probably safe to ignore the layer name of
> native GRASS vectors.
>

I agree that the layer name is probably mostly informative (at least I
didn't realize so far how/where it is involved in daily work with GRASS).
However, during some recent analysis I discovered that the layer name
affected how tables get renamed when new additional tables in new layers
are created... Then it is weird when the old initial layer name pops up in
a table name.
To better illustrate the issue I generated a working example to reproduce
what I mean. This is based on an INSPIRE GML file where the layer name did
not get renamed during import and where it affected the (re)naming of a
table:


# Create location with EPSG:4258
# Download GML file from
https://geoportal.bafg.de/inspire/download/reporting_units/WFDDesignatedWatersFish/WFDDesignatedWatersFish_DE.gml

# Import vector data with user-defined output name
v.in.ogr input=/home/jradinger/Downloads/WFDDesignatedWatersFish_DE.gml
output=Fishdata
g.region vector=Fishdata

# Check connection parameters
v.db.connect -p map=Fishdata@PERMANENT

#Vector map  is connected by:
#layer <1/WFDDesignatedWatersFish_LIN> table  in database

through driver  with key 
### Layer name got not renamed!

# To reproduce: Add new cat and table on layer 2 and layer 3
v.category input=Fishdata layer=2 output=Fishdata2 option=add
v.db.addtable map=Fishdata2 layer=2
v.category input=Fishdata2 layer=3 output=newFishdata option=add
v.db.addtable map=newFishdata layer=3

db.tables -p
# A original table in layer 1 was renamed to
newFishdata_WFDDesignatedWatersFish_LIN using the initial layer name
#

Don't know the underlying mechanisms how tables get renamed

/Johannes


>
> Markus M
>
> >
> > cheers,
> > Johannes
> >
> >
> > ___
> > grass-user mailing list
> > grass-user@lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/grass-user
>
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user