[GRASS-user] Loading JSON data in GRASS

Arighna roy.arighna at gmail.com
Sun Nov 23 16:07:27 PST 2014


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 at 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 at gmail.com <mailto:roy.arighna at 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 at gmail.com <mailto:wenzeslaus at 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 at gmail.com <mailto:roy.arighna at 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 at gmail.com <mailto:roy.arighna at gmail.com> ]
Sent: Wednesday, October 22, 2014 1:52 PM
To: 'Moritz Lennert'
Cc: grass-user at lists.osgeo.org <mailto:grass-user at 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 at club.worldonline.be <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 <mailto: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",
"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

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20141123/b380cc27/attachment.html>


More information about the grass-user mailing list