Points to area workflow

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Points to area workflow

Rich Shepard
I don't remember the workflow converting corner points into an area and find
no saved example here.

When I try the sequence:

v.to.lines in=anal_corners out=anal_bnd
v.build map=anal_bnd opt=build
v.centroids in=anal_bnd out=anal_area

grass tells me 'input vector map contains no boundaries'.

What have I missed?

TIA,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Thomas Adams-2
Rich,

How are you seeing that points convert to an area? An area encompassing the points?? In which case you probably want v.hull (https://grass.osgeo.org/grass76/manuals/v.hull.html).

One further suggestion, consider changing your variable names for, uh, readability??

Tom


On Sat, Jul 20, 2019 at 11:58 AM Rich Shepard <[hidden email]> wrote:
I don't remember the workflow converting corner points into an area and find
no saved example here.

When I try the sequence:

v.to.lines in=anal_corners out=anal_bnd
v.build map=anal_bnd opt=build
v.centroids in=anal_bnd out=anal_area

grass tells me 'input vector map contains no boundaries'.

What have I missed?

TIA,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user


--
Thomas E Adams, III
1724 Sage Lane
Blacksburg, VA 24060
[hidden email] (personal)

1 (513) 739-9512 (cell)


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Micha Silver-2

On 20/07/2019 19:23, Thomas Adams wrote:
Rich,

How are you seeing that points convert to an area? An area encompassing the points?? In which case you probably want v.hull (https://grass.osgeo.org/grass76/manuals/v.hull.html).

One further suggestion, consider changing your variable names for, uh, readability??

Tom


On Sat, Jul 20, 2019 at 11:58 AM Rich Shepard <[hidden email]> wrote:
I don't remember the workflow converting corner points into an area and find
no saved example here.

When I try the sequence:

v.to.lines in=anal_corners out=anal_bnd
v.build map=anal_bnd opt=build
v.centroids in=anal_bnd out=anal_area

grass tells me 'input vector map contains no boundaries'.

What have I missed?


v.to. lines is *not* what you want. That module takes a polygon and converts the boundaries to lines.


If you want to go straight from the point coordinates to a polygon, you can use the GRASS standard ASCII format and pipe directly to v.in.ascii:

echo "VERTI:
B 1 5
 -123.940000 45.150100 
 -123.940000 45.145400
 -123.960000 45.145400
 -123.960000 45.150100
 -123.940000 45.150100
 1 1
C 1 1
 -123.950000 45.147500
 1 1" | v.in.ascii input=- output=analysis_region format=standard

Check the ASCII vector format page: https://grass.osgeo.org/grass77/manuals/vectorascii.html


TIA,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user


--
Thomas E Adams, III
1724 Sage Lane
Blacksburg, VA 24060
[hidden email] (personal)

1 (513) 739-9512 (cell)


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
In reply to this post by Thomas Adams-2
On Sat, 20 Jul 2019, Thomas Adams wrote:

> How are you seeing that points convert to an area? An area encompassing
> the points?? In which case you probably want v.hull (
> https://grass.osgeo.org/grass76/manuals/v.hull.html).

> One further suggestion, consider changing your variable names for, uh,
> readability??

Tom,

The points, as the file name suggests, are the corners of the analysis area.
I don't want to calculate a convex hull on four corner points, I want
boundary lines connecting the corners, then the area within the boundary.

Thanks,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow [RESOLVED]

Rich Shepard
In reply to this post by Micha Silver-2
On Sat, 20 Jul 2019, Micha Silver wrote:

> v.to. lines is *not* what you want. That module takes a polygon and
> converts the boundaries to lines.

Micha,

I wondered about that.

> If you want to go straight from the point coordinates to a polygon, you
> can use the GRASS standard ASCII format and pipe directly to v.in.ascii:
>
> echo "VERTI:
> B 1 5
>  -123.940000 45.150100
>  -123.940000 45.145400
>  -123.960000 45.145400
>  -123.960000 45.150100
>  -123.940000 45.150100
>  1 1
> C 1 1
>  -123.950000 45.147500
>  1 1" | v.in.ascii input=- output=analysis_region format=standard

Ah, yes! That looks familiar. I should use the standard format and leave the
point format for a cloud of points.

Thanks,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
On Sat, 20 Jul 2019, Micha Silver wrote:

> If you want to go straight from the point coordinates to a polygon, you
> can use the GRASS standard ASCII format and pipe directly to v.in.ascii:

> echo "VERTI:
> B 1 5
>  -123.940000 45.150100
>  -123.940000 45.145400
>  -123.960000 45.145400
>  -123.960000 45.150100
>  -123.940000 45.150100
>  1 1
> C 1 1
>  -123.950000 45.147500
>  1 1" | v.in.ascii input=- output=analysis_region format=standard

Micha,

Reading the v.in.ascii manual page I see the one standard format example but
no explanation of how to write the data input files.

I have only the five points defining the rectangle and even specifying
'skip=5' the module is looking for a header. Where are the standard format
details described in detail?

Thanks,

Rich


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Helmut Kudrnovsky
>Where are the standard format
>details described in detail?

in the bottom of the manual
(https://grass.osgeo.org/grass76/manuals/v.in.ascii.html) there is a link to
/GRASS ASCII vector format specification/




-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
best regards
Helmut
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
On Sat, 20 Jul 2019, Helmut Kudrnovsky wrote:

> in the bottom of the manual
> (https://grass.osgeo.org/grass76/manuals/v.in.ascii.html) there is a link to
> GRASS ASCII vector format specification

Helmut,

Thanks very much. It's also on the 7.7 manual page, but it hadn't registered
with me when I read that page. I had read it years ago and did not remember
where it was found.

The number after the 'B' is the number of points that define the boundary,
but why are there two 1's after the 'C' for centroid?

Best regards,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow [RESOLVED]

Rich Shepard
On Sat, 20 Jul 2019, Rich Shepard wrote:

> but why are there two 1's after the 'C' for centroid?

Ah, the number of categories.

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Markus Neteler
In reply to this post by Rich Shepard
Rich,

Rich Shepard <[hidden email]> schrieb am So., 21. Juli 2019, 00:53:
On Sat, 20 Jul 2019, Helmut Kudrnovsky wrote:

> in the bottom of the manual
> (https://grass.osgeo.org/grass76/manuals/v.in.ascii.html) there is a link to
> GRASS ASCII vector format specification

Helmut,

Thanks very much. It's also on the 7.7 manual page, but it hadn't registered
with me when I read that page. I had read it years ago and did not remember
where it was found.

Please suggest where to improve the manual. Your contributions are most welcome.
You could even edit right away in GitHub.

Of course everybody is invited! :)

Best
Markus


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
On Sun, 21 Jul 2019, Markus Neteler wrote:

> Please suggest where to improve the manual. Your contributions are most
> welcome. You could even edit right away in GitHub.

Markus,

The simplist fix is to add an asterisk or parenthetical note at the standard
format example that directs the reader to the link. I'll do this later
today.

Regards,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
In reply to this post by Micha Silver-2
On Sat, 20 Jul 2019, Micha Silver wrote:

> echo "VERTI:
> B 1 5
>  -123.940000 45.150100
>  -123.940000 45.145400
>  -123.960000 45.145400
>  -123.960000 45.150100
>  -123.940000 45.150100
>  1 1
> C 1 1
>  -123.950000 45.147500
>  1 1" | v.in.ascii input=- output=analysis_region format=standard

I did this in two steps, rather than echoing the data file because it and
where grass runs are two different directories.

analysis_points.dat:

VERTI:
B 5 # There are 5 coordinates and no categories
  -123.940000 45.150100
  -123.940000 45.145400
  -123.960000 45.150100
  -123.960000 45.145400
  -123.940000 45.150100
  1 1
C 1
  -123.950000 45.147500
  1 1

GRASS now fails to import the data file:

v.in.ascii in=analysis_points.dat out=analysis_corners for=standard --o
WARNING: Error reading ASCII file: (unknown type) [ 1 1]
ERROR: Import failed

Grass seems to not like the layer and category number for the centroid as
removing those for the boundary produces the same error.

What am I still missing?

Regards,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Micha Silver-2

On 7/21/19 8:01 PM, Rich Shepard wrote:
On Sat, 20 Jul 2019, Micha Silver wrote:

echo "VERTI:
B 1 5
 -123.940000 45.150100
 -123.940000 45.145400
 -123.960000 45.145400
 -123.960000 45.150100
 -123.940000 45.150100
 1 1
C 1 1
 -123.950000 45.147500
 1 1" | v.in.ascii input=- output=analysis_region format=standard

I did this in two steps, rather than echoing the data file because it and
where grass runs are two different directories.

analysis_points.dat:

VERTI:
B 5            # There are 5 coordinates and no categories
 -123.940000 45.150100
 -123.940000 45.145400
 -123.960000 45.150100
 -123.960000 45.145400
 -123.940000 45.150100
 1 1
C 1
 -123.950000 45.147500
 1 1

GRASS now fails to import the data file:

v.in.ascii in=analysis_points.dat out=analysis_corners for=standard --o
WARNING: Error reading ASCII file: (unknown type) [ 1 1]
ERROR: Import failed


Double check that you have a leading space (or tab) on the lines with the layer and category: " 1  1"


Grass seems to not like the layer and category number for the centroid as
removing those for the boundary produces the same error.

What am I still missing?

Regards,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
On Sun, 21 Jul 2019, Micha Silver wrote:

>       VERTI:
>       B 5            # There are 5 coordinates and no categories
>        -123.940000 45.150100
>        -123.940000 45.145400
>        -123.960000 45.150100
>        -123.960000 45.145400
>        -123.940000 45.150100
>        1 1
>       C 1
>        -123.950000 45.147500
>        1 1

> Double check that you have a leading space (or tab) on the lines with the
> layer and category: " 1  1"

Micha,

There is a space preceeding each coordinate and layer line. The VERTI and
object type start in column 1 while the other lines start in column 2.

Thanks,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Micha Silver-2

On 7/21/19 9:08 PM, Rich Shepard wrote:

Micha,

There is a space preceeding each coordinate and layer line. The VERTI and
object type start in column 1 while the other lines start in column 2.


I'm getting the same error as you. Maybe you found a bug?

I removed both the " 1 1" lines, and also rearranged the points so that they go in order around the boundary. (I wasn't paying attention, previously they made an "X").


micha@RMS tmp $ cat analysis_boundary.dat
VERTI:
B 5
 -123.960 45.1501
 -123.940 45.1501
 -123.940 45.1454
 -123.960 45.1454
 -123.960 45.1501
C 1
 -123.950 45.1475
micha@RMS tmp $ v.in.ascii input=~/work/tmp/analysis_boundary.dat output=analysis_boundary format=standard --o
Building topology for vector map <analysis_boundary@PERMANENT>...
Registering primitives...
Building areas...
 100%
Attaching islands...
 100%
Attaching centroids...
 100%
micha@RMS tmp $ v.info analysis_boundary
 +----------------------------------------------------------------------------+
 | Name:            analysis_boundary                                         |
 | Mapset:          PERMANENT                                                 |
 | Location:        WGS84                                                     |
 | Database:        /home/micha/GIS/grass                                     |
 | Title:                                                                     |
 | Map scale:       1:1                                                       |
 | Name of creator: micha                                                     |
 | Organization:                                                              |
 | Source date:     Sun Jul 21 21:48:47 2019                                  |
 | Timestamp (first layer): none                                              |
 |----------------------------------------------------------------------------|
 | Map format:      native                                                    |
 |----------------------------------------------------------------------------|
 |   Type of map: vector (level: 2)                                           |
 |                                                                            |
 |   Number of points:       0               Number of centroids:  1          |
 |   Number of lines:        0               Number of boundaries: 1          |
 |   Number of areas:        1               Number of islands:    1          |
 |                                                                            |
 |   Map is 3D:              No                                               |
 |   Number of dblinks:      0                                                |
 |                                                                            |
 |   Projection: Latitude-Longitude                                           |
 |                                                                            |
 |               N:      45:09:00.36N    S:      45:08:43.44N                 |
 |               E:        123:56:24W    W:        123:57:36W                 |
 |                                                                            |
 |   Digitization threshold: 0                                                |
 |   Comment:                                                                 |
 |                                                                            |
 +----------------------------------------------------------------------------+

micha@RMS tmp $ g.version
GRASS 7.6.1 (2019)

Note that you now have a geometry with no category column. So next will have to be

v.category option=add ....



Thanks,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow [REALLY FIXED]

Rich Shepard
On Sun, 21 Jul 2019, Micha Silver wrote:

> I removed both the " 1 1" lines, and also rearranged the points so that
> they go in order around the boundary. (I wasn't paying attention,
> previously they made an "X").

Micha,

Oops! I didn't pay attention to this. I first listed the corners NE and SW
then filled in the others. Changed the order of the coordinates and removed
the layer/category lines for the boundary and centroid and it built.

Fixed and working.

Thanks very much for your patient assistance,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Thomas Adams-2
In reply to this post by Micha Silver-2
Micha & Rich:

I was able to successfully import & display the boundary from Rich's example:

v.in.ascii --overwrite input=/media/teaiii/development/grass/test_analysis_boundary.dat output=test_analysis_boundary format=standard separator=space

I used GRASS 7.6 with the GUI, but the command above worked...

Tom

On Sun, Jul 21, 2019 at 3:03 PM Micha Silver <[hidden email]> wrote:

On 7/21/19 9:08 PM, Rich Shepard wrote:

Micha,

There is a space preceeding each coordinate and layer line. The VERTI and
object type start in column 1 while the other lines start in column 2.


I'm getting the same error as you. Maybe you found a bug?

I removed both the " 1 1" lines, and also rearranged the points so that they go in order around the boundary. (I wasn't paying attention, previously they made an "X").


micha@RMS tmp $ cat analysis_boundary.dat
VERTI:
B 5
 -123.960 45.1501
 -123.940 45.1501
 -123.940 45.1454
 -123.960 45.1454
 -123.960 45.1501
C 1
 -123.950 45.1475
micha@RMS tmp $ v.in.ascii input=~/work/tmp/analysis_boundary.dat output=analysis_boundary format=standard --o
Building topology for vector map <analysis_boundary@PERMANENT>...
Registering primitives...
Building areas...
 100%
Attaching islands...
 100%
Attaching centroids...
 100%
micha@RMS tmp $ v.info analysis_boundary
 +----------------------------------------------------------------------------+
 | Name:            analysis_boundary                                         |
 | Mapset:          PERMANENT                                                 |
 | Location:        WGS84                                                     |
 | Database:        /home/micha/GIS/grass                                     |
 | Title:                                                                     |
 | Map scale:       1:1                                                       |
 | Name of creator: micha                                                     |
 | Organization:                                                              |
 | Source date:     Sun Jul 21 21:48:47 2019                                  |
 | Timestamp (first layer): none                                              |
 |----------------------------------------------------------------------------|
 | Map format:      native                                                    |
 |----------------------------------------------------------------------------|
 |   Type of map: vector (level: 2)                                           |
 |                                                                            |
 |   Number of points:       0               Number of centroids:  1          |
 |   Number of lines:        0               Number of boundaries: 1          |
 |   Number of areas:        1               Number of islands:    1          |
 |                                                                            |
 |   Map is 3D:              No                                               |
 |   Number of dblinks:      0                                                |
 |                                                                            |
 |   Projection: Latitude-Longitude                                           |
 |                                                                            |
 |               N:      45:09:00.36N    S:      45:08:43.44N                 |
 |               E:        123:56:24W    W:        123:57:36W                 |
 |                                                                            |
 |   Digitization threshold: 0                                                |
 |   Comment:                                                                 |
 |                                                                            |
 +----------------------------------------------------------------------------+

micha@RMS tmp $ g.version
GRASS 7.6.1 (2019)

Note that you now have a geometry with no category column. So next will have to be

v.category option=add ....



Thanks,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user


--
Thomas E Adams, III
1724 Sage Lane
Blacksburg, VA 24060
[hidden email] (personal)

1 (513) 739-9512 (cell)


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
On Sun, 21 Jul 2019, Thomas Adams wrote:

> I was able to successfully import & display the boundary from Rich's
> example:

Thomas,

Listing the corner coordinates in order (which I should have done in the
first place) and removing the layer/category lines for the border and
centroid pleased v.in.ascii. I suspect it was the extraneous lines that
caused the rejection.

Regards,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Rich Shepard
In reply to this post by Markus Neteler
On Sun, 21 Jul 2019, Markus Neteler wrote:

> You could even edit right away in GitHub.

Markus,

I looked at <https://github.com/OSGeo/grass> and did not see a link to the
manual pages. Please provide the URL if you'd like me to tweak the
v.in.ascii manual page.

Regards,

Rich
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Points to area workflow

Helmut Kudrnovsky
Rich Shepard wrote

> On Sun, 21 Jul 2019, Markus Neteler wrote:
>
>> You could even edit right away in GitHub.
>
> Markus,
>
> I looked at &lt;https://github.com/OSGeo/grass&gt; and did not see a link
> to the
> manual pages. Please provide the URL if you'd like me to tweak the
> v.in.ascii manual page.
>
> Regards,
>
> Rich
> _______________________________________________
> grass-user mailing list

> grass-user@.osgeo

> https://lists.osgeo.org/mailman/listinfo/grass-user

See
https://github.com/OSGeo/grass/blob/master/vector/v.in.ascii/v.in.ascii.html




-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
best regards
Helmut
12