[GRASS-user] Loading JSON data in GRASS

Arighna roy.arighna at gmail.com
Wed Oct 22 11:51:36 PDT 2014

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


-----Original Message-----
From: Moritz Lennert [mailto:mlennert at club.worldonline.be] 
Sent: Wednesday, October 22, 2014 7:16 AM
To: Arighna; 'Vaclav Petras'
Cc: grass-user at 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",

     "type": "Point",

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




[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





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


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

More information about the grass-user mailing list