[GRASS-user] v.in.ascii data error

I've added elevation and a feature name to the standard format v.in.ascii
file. Grass reports an import error; the same error occurs without those two
added columns. I'm not seeing the error, your fresh eyes will see it.

Data file:
B 5
  45.654023|-122.980241|393|Shop
  45.653931|-122.980315|393|Shop
  45.653960|-122.979910|393|Shop
  45.653856|-122.979831|393|Shop
  45.654023|-122.980241|393|Shop

Command:
v.in.ascii -z in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns='x double precision, y double precision, z integer, label char(4)' --o

Results:
v.in.ascii -z in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns='x double precision, y double precision, z integer, label char(4)' --o
WARNING: Unexpected data in vector header:
          [B 5]
ERROR: Import failed

I've not calculated a centroid; intend to use v.centroid to add the point to
the bound area.

Help appreciated,

Rich

Hi Rich,

···

Anna Petrasova

Getting benefits from GRASS GIS? Check new ways to contribute back: https://opencollective.com/grass/contribute

On Mon, 22 May 2023, Anna Petrášová wrote:

Data file:
B 5
  45.654023|-122.980241|393|Shop
  45.653931|-122.980315|393|Shop
  45.653960|-122.979910|393|Shop
  45.653856|-122.979831|393|Shop
  45.654023|-122.980241|393|Shop

you are mixing formats, either use 'standard' or 'point', see the
v.in.ascii manual. Likely you need format=point.

Anna,

I know that lines and points use the point format, but boundaries and areas
use the standard format. Your comment informs me that a boundary or area
without a specified centroid is imported in point format and becomes an area
after v.centroid is applied.

I didn't think of this.

Many thanks,

Rich

···

On 22/05/2023 20:06, Rich Shepard wrote:

I’ve added elevation and a feature name to the standard format v.in.ascii
file. Grass reports an import error; the same error occurs without those two
added columns. I’m not seeing the error, your fresh eyes will see it.

Data file:

Do you actually have the text “Data file:” as part of the header? AFAIK, You need, at minimum, “VERTI:” in the header.

B 5
45.654023|-122.980241|393|Shop
45.653931|-122.980315|393|Shop
45.653960|-122.979910|393|Shop
45.653856|-122.979831|393|Shop
45.654023|-122.980241|393|Shop

Command:
v.in.ascii -z in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns=‘x double precision, y double precision, z integer, label char(4)’ --o

Results:
v.in.ascii -z in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns=‘x double precision, y double precision, z integer, label char(4)’ --o
WARNING: Unexpected data in vector header:
[B 5]
ERROR: Import failed

I’ve not calculated a centroid; intend to use v.centroid to add the point to
the bound area.

Help appreciated,

Rich


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

On Mon, 22 May 2023, Micha Silver wrote:

Do you actually have the text "Data file:" as part of the header? AFAIK,
You need, at minimum, "VERTI:" in the header.

Micha,

No.

All resolved now. Anna taught me that a boundary/area without an explicit
defined centroid in the source file needs to be imported in point, rather
than standard format.

Regards,

Rich

On Mon, May 22, 2023 at 2:47 PM Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Mon, 22 May 2023, Anna Petrášová wrote:

Data file:
B 5
45.654023|-122.980241|393|Shop
45.653931|-122.980315|393|Shop
45.653960|-122.979910|393|Shop
45.653856|-122.979831|393|Shop
45.654023|-122.980241|393|Shop

you are mixing formats, either use ‘standard’ or ‘point’, see the
v.in.ascii manual. Likely you need format=point.

Anna,

I know that lines and points use the point format, but boundaries and areas
use the standard format. Your comment informs me that a boundary or area
without a specified centroid is imported in point format and becomes an area
after v.centroid is applied.

That’s not what I meant. Point format is for points, nothing else. If you need areas, you need standard format. See the first example in the man page for importing areas.

I didn’t think of this.

Many thanks,

Rich


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Mon, 22 May 2023, Anna Petrášová wrote:

That's not what I meant. Point format is for points, nothing else. If you
need areas, you need standard format. See the first example in the man
page for importing areas.

Anna,

That's what I thought, and what I had defined in the data file and command.
but with a none-rectangular boundary I don't have the coordinates for a
centroid; although I could just pick a point, I suppose.

Do all standard format boundary data files require me to include a centroid?

Regards,

Rich

That’s not what I meant. Point format is for points, nothing else. If you
need areas, you need standard format. See the first example in the man
page for importing areas.

Anna,

That’s what I thought, and what I had defined in the data file and command.
but with a none-rectangular boundary I don’t have the coordinates for a
centroid; although I could just pick a point, I suppose.

Do all standard format boundary data files require me to include a centroid?

Then yes, just include the boundary and run v.centroids. It was unclear from your first question what it is you actually need.

···

Anna Petrasova

Getting benefits from GRASS GIS? Check new ways to contribute back: https://opencollective.com/grass/contribute

On Tue, 23 May 2023, Anna Petrášová wrote:

Then yes, just include the boundary and run v.centroids. It was unclear
from your first question what it is you actually need.

Anna,

That's what I had done; here are the data file, v.in.ascii command, and
grass' output:

B 5
  45.654023|-122.980241|393|Shop
  45.653931|-122.980315|393|Shop
  45.653960|-122.979910|393|Shop
  45.653856|-122.979831|393|Shop
  45.654023|-122.980241|393|Shop

v.in.ascii -z in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns='x double precision, y double precision, z integer, label char(4)' --o

v.in.ascii -z in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns='x double precision, y double precision, z integer, label char(4)' --o

WARNING: Unexpected data in vector header:
          [B 5]
ERROR: Import failed

====================================================

Looking at the v.in.ascii example 1b I added a 'no header' option to the
command:

v.in.ascii -zn in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns='x double precision, y double precision, z integer, label char(4)' --o

v.in.ascii -zn in=$HOME/projects/oregon/northside-rock/data/shop.txt out=maintenance_bldg format=standard sep=pipe cat=0 x=1 y=2 z=3 columns='x double precision, y double precision, z integer, label char(4)' --o

WARNING: Error reading ASCII file: (bad point) [
          45.654023|-122.980241|393|Shop]

Please tell me what I've done incorrectly.

TIA,

Rich

How the data is formatted is wrong, see the example. With standard format, you need to specify coordinates separated by space. Attributes can’t be used.
B 5
45.654023 -122.980241 393

See also https://grass.osgeo.org/grass82/manuals/vectorascii.html

···

Anna Petrasova

Getting benefits from GRASS GIS? Check new ways to contribute back: https://opencollective.com/grass/contribute

On Tue, 23 May 2023, Anna Petrášová wrote:

How the data is formatted is wrong, see the example. With standard format,
you need to specify coordinates separated by space. Attributes can't be
used.
B 5
45.654023 -122.980241 393

Anna,

Oh! I saw the separator option in the parameter list and assumed it applied
to both formats. Didn't pick up the difference looking at the examples.

Thanks for clarifying.

Regards,

Rich