[GRASS-user] Loading JSON data in GRASS

Arighna roy.arighna at gmail.com
Tue Dec 2 08:51:58 PST 2014



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 at club.worldonline.be] 
Sent: Tuesday, December 02, 2014 3:54 AM
To: Arighna; 'Vaclav Petras'; grass-user at 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



More information about the grass-user mailing list