[GRASS-user] Loading JSON data in GRASS

Hi everybody,

I want to load GeoJSON data in GRASS. I am totally unware of the process. Could anybody please help me to do that?

Thanks & Regards

Arighna Roy

Hi,

here is a basic answer to start with.

···

On Sun, Oct 5, 2014 at 8:44 PM, Arighna <roy.arighna@gmail.com> wrote:

Hi everybody,

I want to load GeoJSON data in GRASS. I am totally unware of the process. Could anybody please help me to do that?

I never tried GeoJSON but with recent enough GRASS GIS and GDAL/OGR, you can use v.in.ogr module (module for import of vector data using OGR).

You can use

v.in.ogr -f

to list all available formats. For me it gives “GeoJSON (rw): GeoJSON”.

Something like:

v.in.ogr dsn=/path/to/data/file.json output=grass_vector_map

should work. I don’t know how it is with layers and features but you will see I guess.

Let us know if it work and if you have any problems.

Vaclav

Thanks & Regards

Arighna Roy


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

Hi Vaclav,

I have loaded the point in GRASS. But the attributes are not loaded successfully. I am posting one sample data. Could you please help me finding what is wrong with the data. Or maybe I am going wrong with the loading process.

{

“type”: “Point”,

“coordinates”: [50.922759,-90.089954],

“current_conditions”:

{

“air_temp”:{“unit”:“F”,“value”:32.0},

“cloud_cover”:{“unit”:“%”,“value”:92.8},

“descriptors”:

{

“cloud_cover_descriptor”:{“code”:20500,“icon”:“http://icons.clearpathapis.com/en-us/style1/v1/128/cover_cloudy.png",“text”:"Cloudy”},

“precipitation_descriptor”:{“code”:61100,“icon”:“http://icons.clearpathapis.com/en-us/style1/v1/128/precip_flurries.png",“text”:"Flurries”},

“visibility_obstruction_descriptor”:{“code”:10500,“icon”:“http://icons.clearpathapis.com/en-us/style1/v1/128/error_none.png",“text”:"None”},

“weather_descriptor”:{“code”:61100,“icon”:“http://icons.clearpathapis.com/en-us/style1/v1/128/precip_flurries.png",“text”:"Flurries”},

“wind_direction_descriptor”:{“code”:51800,“icon”:“http://icons.clearpathapis.com/en-us/style1/v1/128/direction_w.png",“text”:"West”}

},

“dew_point”:{“unit”:“F”,“value”:32.0},

“ice_acc_last_hour”:{“unit”:“in”,“value”:0.0},

“liquid_acc_last_hour”:{“unit”:“in”,“value”:0.0},

“msl_pressure”:{“unit”:“mb”,“value”:994.0},

“precip_acc_last_hour”:{“unit”:“in”,“value”:0.002},

“relative_humidity”:{“unit”:“%”,“value”:91.0},

“snow_acc_last_hour”:{“unit”:“in”,“value”:0.01},

“station_pressure”:{“unit”:“mb”,“value”:946.0},

“u_wind_speed”:{“unit”:“mph”,“value”:4.8},

“v_wind_speed”:{“unit”:“mph”,“value”:0.9},

“valid_time_end”:1412667600.0,

“valid_time_start”:1412664000.0,

“visibility”:{“unit”:“mi”,“value”:10.0},

“wind_direction”:{“unit”:“degrees”,“value”:260.0},

“wind_speed”:{“unit”:“mph”,“value”:7.0}

}

}

Thanks in advance

Arighna

From: Arighna [mailto:roy.arighna@gmail.com]
Sent: Monday, October 06, 2014 10:28 AM
To: ‘Vaclav Petras’
Subject: RE: [GRASS-user] Loading JSON data in GRASS

Hi Vaclav,

I have found the module and found GeoJSON in there. I will try to load the data and will definitely post you once get success.

Arighna

From: Vaclav Petras [mailto:wenzeslaus@gmail.com]
Sent: Sunday, October 05, 2014 10:56 PM
To: Arighna
Cc: GRASS user list; Moritz Lennert
Subject: Re: [GRASS-user] Loading JSON data in GRASS

Hi,

here is a basic answer to start with.

On Sun, Oct 5, 2014 at 8:44 PM, Arighna <roy.arighna@gmail.com> wrote:

Hi everybody,

I want to load GeoJSON data in GRASS. I am totally unware of the process. Could anybody please help me to do that?

I never tried GeoJSON but with recent enough GRASS GIS and GDAL/OGR, you can use v.in.ogr module (module for import of vector data using OGR).

You can use

v.in.ogr -f

to list all available formats. For me it gives “GeoJSON (rw): GeoJSON”.

Something like:

v.in.ogr dsn=/path/to/data/file.json output=grass_vector_map

should work. I don’t know how it is with layers and features but you will see I guess.

Let us know if it work and if you have any problems.

Vaclav

Thanks & Regards

Arighna Roy


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

On 21/10/14 04:38, Arighna wrote:

Hi Vaclav,

I have loaded the point in GRASS. But the attributes are not loaded
successfully. I am posting one sample data. Could you please help me
finding what is wrong with the data. Or maybe I am going wrong with the
loading process.

This sample data is not enough. According to the ogr GeoJSON format manual [1], "according to the GeoJSON Specification, only the Feature object must have a member with name properties. Each and every member of properties is translated to OGR object of type of OGRField and added to corresponding OGRFeature object."

In other words: attributes have to be members of the member properties of the Feature object.

I can get a bit further in importing your attributes by using the following at the beginning

{"type": "Feature",
"geometry":
{

     "type": "Point",

     "coordinates": [50.922759,-90.089954]
},

                 "properties":

                 {

                                 "air_temp":{"unit":"F","value":32.0},

[then the rest is identical to JSON code].

However, this imports the attributes as such (example is air_temp):

{ "unit": "F", "value": 32.0 }

If I change the JSON to

                 "properties":

                 {

                                 "air_temp":32.0,

etc

I get the expected attribute values, i.e. air_temp is 32.0 which is recognized as double precision in the attribute table.

To check quickly how ogr parses the attributes, you can check on the command line with

ogrinfo point.json OGRGeoJSON

Moritz

[1] http://www.gdal.org/drv_geojson.html

Awesome man. It worked now. Thanks a ton Moritz.

Arighna

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Wednesday, October 22, 2014 7:16 AM
To: Arighna; 'Vaclav Petras'
Cc: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 21/10/14 04:38, Arighna wrote:

Hi Vaclav,

I have loaded the point in GRASS. But the attributes are not loaded
successfully. I am posting one sample data. Could you please help me
finding what is wrong with the data. Or maybe I am going wrong with
the loading process.

This sample data is not enough. According to the ogr GeoJSON format manual
[1], "according to the GeoJSON Specification, only the Feature object must
have a member with name properties. Each and every member of properties is
translated to OGR object of type of OGRField and added to corresponding
OGRFeature object."

In other words: attributes have to be members of the member properties of
the Feature object.

I can get a bit further in importing your attributes by using the following
at the beginning

{"type": "Feature",
"geometry":
{

     "type": "Point",

     "coordinates": [50.922759,-90.089954] },

                 "properties":

                 {

                                 "air_temp":{"unit":"F","value":32.0},

[then the rest is identical to JSON code].

However, this imports the attributes as such (example is air_temp):

{ "unit": "F", "value": 32.0 }

If I change the JSON to

                 "properties":

                 {

                                 "air_temp":32.0,

etc

I get the expected attribute values, i.e. air_temp is 32.0 which is
recognized as double precision in the attribute table.

To check quickly how ogr parses the attributes, you can check on the command
line with

ogrinfo point.json OGRGeoJSON

Moritz

[1] http://www.gdal.org/drv_geojson.html

I am not sure how I can load multiple data in the same map. Putting
everything in the same json file does not work. Also, using an existing map
for loading a new json file does not work.

-----Original Message-----
From: Arighna [mailto:roy.arighna@gmail.com]
Sent: Wednesday, October 22, 2014 1:52 PM
To: 'Moritz Lennert'
Cc: grass-user@lists.osgeo.org; 'Vaclav Petras'
Subject: RE: [GRASS-user] Loading JSON data in GRASS

Awesome man. It worked now. Thanks a ton Moritz.

Arighna

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Wednesday, October 22, 2014 7:16 AM
To: Arighna; 'Vaclav Petras'
Cc: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 21/10/14 04:38, Arighna wrote:

Hi Vaclav,

I have loaded the point in GRASS. But the attributes are not loaded
successfully. I am posting one sample data. Could you please help me
finding what is wrong with the data. Or maybe I am going wrong with
the loading process.

This sample data is not enough. According to the ogr GeoJSON format manual
[1], "according to the GeoJSON Specification, only the Feature object must
have a member with name properties. Each and every member of properties is
translated to OGR object of type of OGRField and added to corresponding
OGRFeature object."

In other words: attributes have to be members of the member properties of
the Feature object.

I can get a bit further in importing your attributes by using the following
at the beginning

{"type": "Feature",
"geometry":
{

     "type": "Point",

     "coordinates": [50.922759,-90.089954] },

                 "properties":

                 {

                                 "air_temp":{"unit":"F","value":32.0},

[then the rest is identical to JSON code].

However, this imports the attributes as such (example is air_temp):

{ "unit": "F", "value": 32.0 }

If I change the JSON to

                 "properties":

                 {

                                 "air_temp":32.0,

etc

I get the expected attribute values, i.e. air_temp is 32.0 which is
recognized as double precision in the attribute table.

To check quickly how ogr parses the attributes, you can check on the command
line with

ogrinfo point.json OGRGeoJSON

Moritz

[1] http://www.gdal.org/drv_geojson.html

On Thu, Nov 6, 2014 at 3:54 PM, Arighna <roy.arighna@gmail.com> wrote:

I am not sure how I can load multiple data in the same map. Putting
everything in the same json file does not work. Also, using an existing map
for loading a new json file does not work.

Import individual JSON files separately and then patch (merge) them using

v.patch.

http://grass.osgeo.org/grass70/manuals/v.patch.html

-----Original Message-----
From: Arighna [mailto:roy.arighna@gmail.com]
Sent: Wednesday, October 22, 2014 1:52 PM
To: 'Moritz Lennert'
Cc: grass-user@lists.osgeo.org; 'Vaclav Petras'
Subject: RE: [GRASS-user] Loading JSON data in GRASS

Awesome man. It worked now. Thanks a ton Moritz.

Arighna

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Wednesday, October 22, 2014 7:16 AM
To: Arighna; 'Vaclav Petras'
Cc: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 21/10/14 04:38, Arighna wrote:
> Hi Vaclav,
>
> I have loaded the point in GRASS. But the attributes are not loaded
> successfully. I am posting one sample data. Could you please help me
> finding what is wrong with the data. Or maybe I am going wrong with
> the loading process.

This sample data is not enough. According to the ogr GeoJSON format manual
[1], "according to the GeoJSON Specification, only the Feature object must
have a member with name properties. Each and every member of properties is
translated to OGR object of type of OGRField and added to corresponding
OGRFeature object."

In other words: attributes have to be members of the member properties of
the Feature object.

I can get a bit further in importing your attributes by using the following
at the beginning

{"type": "Feature",
"geometry":
{

     "type": "Point",

     "coordinates": [50.922759,-90.089954] },

                 "properties":

                 {

                                 "air_temp":{"unit":"F","value":32.0},

[then the rest is identical to JSON code].

However, this imports the attributes as such (example is air_temp):

{ "unit": "F", "value": 32.0 }

If I change the JSON to

                 "properties":

                 {

                                 "air_temp":32.0,

etc

I get the expected attribute values, i.e. air_temp is 32.0 which is
recognized as double precision in the attribute table.

To check quickly how ogr parses the attributes, you can check on the
command
line with

ogrinfo point.json OGRGeoJSON

Moritz

[1] http://www.gdal.org/drv_geojson.html

Hi,

I am trying to append points to a new map patch_map6.

v.patch -e input=patch_map1 output=patch_map6

When I run the above command I get the following error.

ERROR: Key column not found

Roy

From: Vaclav Petras [mailto:wenzeslaus@gmail.com]
Sent: Sunday, November 23, 2014 5:17 PM
To: Arighna
Subject: Re: [GRASS-user] Loading JSON data in GRASS

Hi Roy,

please send the question to the mailing list. I was not using v.patch with attribute table lately, so I don’t know and even if I would the question/answer might useful for other people too. Try -e flag and post also result of that (not only if it does not work but even if it works).

Vaclav

On Sun, Nov 23, 2014 at 6:11 PM, Arighna <roy.arighna@gmail.com> wrote:

Hi Vaclav,

When I patch two maps, I can see 2 points in the same map but the attribute table is not populated for the new point.

v.patch -a input=patch_map1 output=patch_map5 –overwrite

I am trying to append points to patch_map5. In the above command I can see only one row in the attribute table. Map1 attributes did not get populated.

Roy

From: Vaclav Petras [mailto:wenzeslaus@gmail.com]
Sent: Thursday, November 06, 2014 7:08 PM
To: Arighna
Cc: Moritz Lennert; GRASS user list

Subject: Re: [GRASS-user] Loading JSON data in GRASS

On Thu, Nov 6, 2014 at 3:54 PM, Arighna <roy.arighna@gmail.com> wrote:

I am not sure how I can load multiple data in the same map. Putting
everything in the same json file does not work. Also, using an existing map
for loading a new json file does not work.

Import individual JSON files separately and then patch (merge) them using v.patch.

http://grass.osgeo.org/grass70/manuals/v.patch.html

-----Original Message-----
From: Arighna [mailto:roy.arighna@gmail.com]
Sent: Wednesday, October 22, 2014 1:52 PM
To: ‘Moritz Lennert’
Cc: grass-user@lists.osgeo.org; ‘Vaclav Petras’
Subject: RE: [GRASS-user] Loading JSON data in GRASS

Awesome man. It worked now. Thanks a ton Moritz.

Arighna

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Wednesday, October 22, 2014 7:16 AM
To: Arighna; ‘Vaclav Petras’
Cc: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 21/10/14 04:38, Arighna wrote:

Hi Vaclav,

I have loaded the point in GRASS. But the attributes are not loaded
successfully. I am posting one sample data. Could you please help me
finding what is wrong with the data. Or maybe I am going wrong with
the loading process.

This sample data is not enough. According to the ogr GeoJSON format manual
[1], “according to the GeoJSON Specification, only the Feature object must
have a member with name properties. Each and every member of properties is
translated to OGR object of type of OGRField and added to corresponding
OGRFeature object.”

In other words: attributes have to be members of the member properties of
the Feature object.

I can get a bit further in importing your attributes by using the following
at the beginning

{“type”: “Feature”,
“geometry”:
{

“type”: “Point”,

“coordinates”: [50.922759,-90.089954] },

“properties”:

{

“air_temp”:{“unit”:“F”,“value”:32.0},

[then the rest is identical to JSON code].

However, this imports the attributes as such (example is air_temp):

{ “unit”: “F”, “value”: 32.0 }

If I change the JSON to

“properties”:

{

“air_temp”:32.0,

etc

I get the expected attribute values, i.e. air_temp is 32.0 which is
recognized as double precision in the attribute table.

To check quickly how ogr parses the attributes, you can check on the command
line with

ogrinfo point.json OGRGeoJSON

Moritz

[1] http://www.gdal.org/drv_geojson.html

Hi,

I am trying to append points to a new map patch_map6.

v.patch -e input=patch_map1 output=patch_map6

When I run the above command I get the following error.

ERROR: Key column not found

I don't know which column it is looking for.

Roy

On 30/11/14 06:10, arighna roy wrote:

Hi,

  I am trying to append points to a new map patch_map6.

v.patch -e input=patch_map1 output=patch_map6

When I run the above command I get the following error.

ERROR: Key column not found

I don't know which column it is looking for.

The "key column" is the column in the attribute table containing the category values (~ ids) of the features in your map, thus allowing to link the features to the attributes.

You can use 'v.db.connect -p patch_map1' to see the details of the connection for patch_map1.

Moritz

Hi Moritz,

Thanks a lot for your reply.

It is connected with the 'cat' column as I didn't provide any key column
while importing the data. Both the input and the output maps have the key
column as 'cat'. Still I am getting the error. Could this be a problem that
for both the maps the 'cat 'values are 1?

Also I was trying to import the data with a specific key column. But there
is no provision for doing that.
I tried these commands.

v.in.ogr input=/home/aroy/geojson_sample/patch/patch1.1.geojson
output=patch_test1 key=category
ERROR: Sorry, <input> is not a valid parameter
ERROR: Sorry, <key> is not a valid parameter
ERROR: Required parameter <dsn> not set:
        (OGR datasource name)

v.in.ogr dsn=/home/aroy/geojson_sample/patch/patch1.1.geojson
output=patch_test1 key=category
ERROR: Sorry, <key> is not a valid parameter

Thanks & Regards
Roy

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Tuesday, December 02, 2014 2:41 AM
To: arighna roy; Vaclav Petras; grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 30/11/14 06:10, arighna roy wrote:

Hi,

  I am trying to append points to a new map patch_map6.

v.patch -e input=patch_map1 output=patch_map6

When I run the above command I get the following error.

ERROR: Key column not found

I don't know which column it is looking for.

The "key column" is the column in the attribute table containing the
category values (~ ids) of the features in your map, thus allowing to link
the features to the attributes.

You can use 'v.db.connect -p patch_map1' to see the details of the
connection for patch_map1.

Moritz

On 02/12/14 10:12, Arighna wrote:

Hi Moritz,

Thanks a lot for your reply.

It is connected with the 'cat' column as I didn't provide any key column
while importing the data. Both the input and the output maps have the key
column as 'cat'. Still I am getting the error. Could this be a problem that
for both the maps the 'cat 'values are 1?

Also I was trying to import the data with a specific key column. But there
is no provision for doing that.
I tried these commands.

v.in.ogr input=/home/aroy/geojson_sample/patch/patch1.1.geojson
output=patch_test1 key=category
ERROR: Sorry, <input> is not a valid parameter
ERROR: Sorry, <key> is not a valid parameter
ERROR: Required parameter <dsn> not set:
         (OGR datasource name)

v.in.ogr dsn=/home/aroy/geojson_sample/patch/patch1.1.geojson
output=patch_test1 key=category
ERROR: Sorry, <key> is not a valid parameter

You are using grass6.4, I suppose ? In that version v.in.ogr does not have a key parameter.

Could you send us the output of

v.db.connect -p patch_test1

and

v.info -c patch_test1

?

Also, I don't really understand the sens of your v.patch:

v.patch -e input=patch_map1 output=patch_map6

Why only one input map ? Doing that is somewhat like copying patch_map1 to patch_map6...

If patch_map6 already exists and you want to append patch_map1 to it, then you have to use the '-a' flag.

Moritz

I am using -e flag to copy the attribute table as well. I have data in json
format. I am importing json data in separate maps and then patching them
into one map to have all the points in one place. I did not find any smarter
way to import them. Is there any way that I can directly insert the records
in the db instead of saving them in json file first and then importing it?

I am using GRASS 7.0.

v.db.connect -p patch_map1
layer <1/patch_map1> table <patch_map1> in database
</home/shared/research/GRASSDATA/RedRiverValley/aroy/sqlite/sqlite.db>
through driver <sqlite> with key <cat>

v.info -c patch_map1

INTEGER|cat
CHARACTER|air_temp
CHARACTER|cloud_cover
CHARACTER|descriptors
CHARACTER|dew_point
CHARACTER|ice_acc_last_hour
CHARACTER|liquid_acc_last_hour
CHARACTER|msl_pressure
CHARACTER|precip_acc_last_hour
CHARACTER|relative_humidity
CHARACTER|snow_acc_last_hour
CHARACTER|station_pressure
CHARACTER|u_wind_speed
CHARACTER|v_wind_speed
DOUBLE PRECISION|valid_time_end
DOUBLE PRECISION|valid_time_start
CHARACTER|visibility
CHARACTER|wind_direction
CHARACTER|wind_speed
Displaying column types/names for database connection of layer <1>:
(Tue Dec 2 10:47:58 2014) Command finished (0 sec)

Thanks
Roy

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Tuesday, December 02, 2014 3:54 AM
To: Arighna; 'Vaclav Petras'; grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 02/12/14 10:12, Arighna wrote:

Hi Moritz,

Thanks a lot for your reply.

It is connected with the 'cat' column as I didn't provide any key
column while importing the data. Both the input and the output maps
have the key column as 'cat'. Still I am getting the error. Could this
be a problem that for both the maps the 'cat 'values are 1?

Also I was trying to import the data with a specific key column. But
there is no provision for doing that.
I tried these commands.

v.in.ogr input=/home/aroy/geojson_sample/patch/patch1.1.geojson
output=patch_test1 key=category
ERROR: Sorry, <input> is not a valid parameter
ERROR: Sorry, <key> is not a valid parameter
ERROR: Required parameter <dsn> not set:
         (OGR datasource name)

v.in.ogr dsn=/home/aroy/geojson_sample/patch/patch1.1.geojson
output=patch_test1 key=category
ERROR: Sorry, <key> is not a valid parameter

You are using grass6.4, I suppose ? In that version v.in.ogr does not have a
key parameter.

Could you send us the output of

v.db.connect -p patch_test1

and

v.info -c patch_test1

?

Also, I don't really understand the sens of your v.patch:

v.patch -e input=patch_map1 output=patch_map6

Why only one input map ? Doing that is somewhat like copying patch_map1 to
patch_map6...

If patch_map6 already exists and you want to append patch_map1 to it, then
you have to use the '-a' flag.

Moritz

On 02/12/14 17:51, Arighna wrote:

I am using -e flag to copy the attribute table as well. I have data in json
format. I am importing json data in separate maps and then patching them
into one map to have all the points in one place.

So, if you have several patch_map*, then you could just do:

v.patch -e in=patch_map1,patch_map2,patch_map3[,...] output=patched_map

What I don't understand is why you do

v.patch -e in=patch_map1 out=patch_map6

which doesn't patch any maps together, but just copies patch_map1 to patch_map6...

I did not find any smarter
way to import them. Is there any way that I can directly insert the records
in the db instead of saving them in json file first and then importing it?

In what format are they before you save them into json format ?

If you stick with json, couldn't you just glue your json files together before importing ?

I am using GRASS 7.0.

v.db.connect -p patch_map1
layer <1/patch_map1> table <patch_map1> in database
</home/shared/research/GRASSDATA/RedRiverValley/aroy/sqlite/sqlite.db>
through driver <sqlite> with key <cat>

v.info -c patch_map1

INTEGER|cat
CHARACTER|air_temp
CHARACTER|cloud_cover
CHARACTER|descriptors
CHARACTER|dew_point
CHARACTER|ice_acc_last_hour
CHARACTER|liquid_acc_last_hour
CHARACTER|msl_pressure
CHARACTER|precip_acc_last_hour
CHARACTER|relative_humidity
CHARACTER|snow_acc_last_hour
CHARACTER|station_pressure
CHARACTER|u_wind_speed
CHARACTER|v_wind_speed
DOUBLE PRECISION|valid_time_end
DOUBLE PRECISION|valid_time_start
CHARACTER|visibility
CHARACTER|wind_direction
CHARACTER|wind_speed
Displaying column types/names for database connection of layer <1>:
(Tue Dec 2 10:47:58 2014) Command finished (0 sec)

Thanks
Roy

Everything looks fine here...

Moritz

Hi Moritz,

This command has worked. Thanks a lot Moritz. This is the command('in' instead of 'input') I was looking for.
Is there any documentation where I could find these commands in detail? I did not find this in http://grass.osgeo.org/documentation/manuals/.

Thanks again
Roy

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Wednesday, December 03, 2014 3:59 AM
To: Arighna; 'Vaclav Petras'; grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 02/12/14 17:51, Arighna wrote:

I am using -e flag to copy the attribute table as well. I have data in
json format. I am importing json data in separate maps and then
patching them into one map to have all the points in one place.

So, if you have several patch_map*, then you could just do:

v.patch -e in=patch_map1,patch_map2,patch_map3[,...] output=patched_map

What I don't understand is why you do

v.patch -e in=patch_map1 out=patch_map6

which doesn't patch any maps together, but just copies patch_map1 to patch_map6...

I did not find any smarter
way to import them. Is there any way that I can directly insert the records
in the db instead of saving them in json file first and then importing it?

In what format are they before you save them into json format ?

If you stick with json, couldn't you just glue your json files together
before importing ?

I am using GRASS 7.0.

v.db.connect -p patch_map1
layer <1/patch_map1> table <patch_map1> in database
</home/shared/research/GRASSDATA/RedRiverValley/aroy/sqlite/sqlite.db>
through driver <sqlite> with key <cat>

v.info -c patch_map1

INTEGER|cat
CHARACTER|air_temp
CHARACTER|cloud_cover
CHARACTER|descriptors
CHARACTER|dew_point
CHARACTER|ice_acc_last_hour
CHARACTER|liquid_acc_last_hour
CHARACTER|msl_pressure
CHARACTER|precip_acc_last_hour
CHARACTER|relative_humidity
CHARACTER|snow_acc_last_hour
CHARACTER|station_pressure
CHARACTER|u_wind_speed
CHARACTER|v_wind_speed
DOUBLE PRECISION|valid_time_end
DOUBLE PRECISION|valid_time_start
CHARACTER|visibility
CHARACTER|wind_direction
CHARACTER|wind_speed
Displaying column types/names for database connection of layer <1>:
(Tue Dec 2 10:47:58 2014) Command finished (0 sec)

Thanks
Roy

Everything looks fine here...

Moritz

On 04/12/14 03:02, Arighna wrote:

Hi Moritz,

This command has worked. Thanks a lot Moritz. This is the command('in' instead of 'input') I was looking for.
Is there any documentation where I could find these commands in detail? I did not find this in http://grass.osgeo.org/documentation/manuals/.

'in' is just short for 'input' and it is a parameter of the command v.patch, not a command in itself. In GRASS you can abbreviate all parameter names as long as your abbreviation is unambiguous.

v.patch -e input=patch_map1,patch_map2,patch_map3[,...] output=patched_map

should work just as well.

Moritz

Thanks again
Roy

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: Wednesday, December 03, 2014 3:59 AM
To: Arighna; 'Vaclav Petras'; grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Loading JSON data in GRASS

On 02/12/14 17:51, Arighna wrote:

I am using -e flag to copy the attribute table as well. I have data in
json format. I am importing json data in separate maps and then
patching them into one map to have all the points in one place.

So, if you have several patch_map*, then you could just do:

v.patch -e in=patch_map1,patch_map2,patch_map3[,...] output=patched_map

What I don't understand is why you do

v.patch -e in=patch_map1 out=patch_map6

which doesn't patch any maps together, but just copies patch_map1 to patch_map6...

I did not find any smarter
way to import them. Is there any way that I can directly insert the records
in the db instead of saving them in json file first and then importing it?

In what format are they before you save them into json format ?

If you stick with json, couldn't you just glue your json files together
before importing ?

I am using GRASS 7.0.

v.db.connect -p patch_map1
layer <1/patch_map1> table <patch_map1> in database
</home/shared/research/GRASSDATA/RedRiverValley/aroy/sqlite/sqlite.db>
through driver <sqlite> with key <cat>

v.info -c patch_map1

INTEGER|cat
CHARACTER|air_temp
CHARACTER|cloud_cover
CHARACTER|descriptors
CHARACTER|dew_point
CHARACTER|ice_acc_last_hour
CHARACTER|liquid_acc_last_hour
CHARACTER|msl_pressure
CHARACTER|precip_acc_last_hour
CHARACTER|relative_humidity
CHARACTER|snow_acc_last_hour
CHARACTER|station_pressure
CHARACTER|u_wind_speed
CHARACTER|v_wind_speed
DOUBLE PRECISION|valid_time_end
DOUBLE PRECISION|valid_time_start
CHARACTER|visibility
CHARACTER|wind_direction
CHARACTER|wind_speed
Displaying column types/names for database connection of layer <1>:
(Tue Dec 2 10:47:58 2014) Command finished (0 sec)

Thanks
Roy

Everything looks fine here...

Moritz