[GRASS-user] Loading JSON data in GRASS

Vaclav Petras wenzeslaus at gmail.com
Thu Nov 6 17:07:38 PST 2014


On Thu, Nov 6, 2014 at 3:54 PM, Arighna <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]
> Sent: Wednesday, October 22, 2014 1:52 PM
> To: 'Moritz Lennert'
> Cc: 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]
> 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",
> "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/20141106/1ed09a14/attachment.html>


More information about the grass-user mailing list