Re: [GRASS-user] Change column data format from double precision to integer

2021-10-05 Thread Rich Shepard

On Tue, 5 Oct 2021, Micha Silver wrote:


AFAIK coordinates in GRASS (including the z coord) are always DOUBLE. The
v.in.ascii function reads the x,y,z columns as DOUBLE.


Micha,

How interesting! In this project the depths are in integers but display as
double


# However, no database connection defined:


Yes, I noticed this, too. The shape files for the same points, imported with
v.in.ogr, do come with a database table. I was going to provide a couple of
samples and ask about this but you've answered my question.


# Now add a new INTEGER column
v.db.addcolumn p1 column="z_int INTEGER"
v.db.update p1 column=z_int query_col="CAST(elev as INTEGER)"



I think that is what you wanted.


Yep. That it is. Saves my time creating examples to get this same knowledge.

Thanks,

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


Re: [GRASS-user] Change column data format from double precision to integer

2021-10-05 Thread Micha Silver

Hi Rich


On 10/5/21 7:59 PM, Rich Shepard wrote:

A vector map's database table has a column named z_int and data type of
double precision as presented in the map's attribute table. It was 
defined
as an int in the v.in.ascii command. How do I change the data type to 
int?




AFAIK coordinates in GRASS (including the z coord) are always DOUBLE. 
The v.in.ascii function reads the x,y,z columns as DOUBLE.


If you declare the columns parameter in v.in.ascii, these attribute 
columns are created as DOUBLE.


I checked the OGC specs for vector data and did not find any mention 
that coordinates should be DOUBLE, but that's usually the case in most 
GIS, to the best of my knowledge.



Having said that, you can create a new attribute column, and populate it 
with integer values from the z coordinate, with the CAST sqlite3 
function. Consider:



echo "1,1,1" | v.in.ascii -z input=- output=p1 separator=comma x=1 y=2 z=3

v.report p1 option=coor
cat|x|y|z
1|1|1|1

# However, no database connection defined:

v.info -c p1
ERROR: Database connection for map  is not defined in DB file


# v.to.db creates new columns as DOUBLE

v.to.db p1 option=coor column="east,north,elev"

v.info -c p1
Displaying column types/names for database connection of layer <1>:
INTEGER|cat
DOUBLE PRECISION|east
DOUBLE PRECISION|north
DOUBLE PRECISION|elev


# Now add a new INTEGER column

v.db.addcolumn p1 column="z_int INTEGER"

v.db.update p1 column=z_int query_col="CAST(elev as INTEGER)"

v.info -c p1
Displaying column types/names for database connection of layer <1>:
INTEGER|cat
DOUBLE PRECISION|east
DOUBLE PRECISION|north
DOUBLE PRECISION|elev
INTEGER|z_int


I think that is what you wanted.




The only option offered in that window is to delete a column by
right-clicking on it. I assume there's a way within GRASS of changing the
data type.

TIA,

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

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


Re: [GRASS-user] city gis data

2021-10-05 Thread Rich Shepard

On Tue, 5 Oct 2021, Janet Choate wrote:


This may seem a ridiculous question -


Janet,

Nah, it isn't.


Can anyone tell me where I can obtain simple city boundary gis data? I
need city boundary gis data for cities in Santa Barbara County that I can
download and import into GRASS.


Try these:
https://www.santabarbaraca.gov › services › maps › default.asp
https://www.countyofsb.org › mapping.sbc
https://www.countyoffice.org › santa-barbara-ca-gis-maps
https://www.sbcag.org › gisportal.html

All found with the duckduckgo search term, 'santa barbara city gis data'

HTH,

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


[GRASS-user] city gis data

2021-10-05 Thread Janet Choate
Hi -
This may seem a ridiculous question -
Can anyone tell me where I can obtain simple city boundary gis data?
I need city boundary gis data for cities in Santa Barbara County that I can
download and import into GRASS.
thank you,
Janet

-- 
Tague Team Lab Manager
1005 Bren Hall
UCSB, Santa Barbara, CA.
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Change column data format from double precision to integer

2021-10-05 Thread Rich Shepard

A vector map's database table has a column named z_int and data type of
double precision as presented in the map's attribute table. It was defined
as an int in the v.in.ascii command. How do I change the data type to int?

The only option offered in that window is to delete a column by
right-clicking on it. I assume there's a way within GRASS of changing the
data type.

TIA,

Rich

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