[GRASS-dev] [GRASS GIS] #2878: "v.in.ogr -i" throws an error when importing a GeoJSON file containing a single point.

GRASS GIS trac at osgeo.org
Wed Jan 27 12:12:17 PST 2016


#2878: "v.in.ogr -i" throws an error when importing a GeoJSON file containing a
single point.
--------------------------+-------------------------------
  Reporter:  pmav99       |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.0.3
 Component:  Vector       |    Version:  unspecified
Resolution:               |   Keywords:  v.in.ogr v.import
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+-------------------------------

Comment (by pmav99):

 Some additional info:

 1. I create a new vector containing two points and I export it:
 {{{
 v.out.ogr input=reservoir_point at damflood type=point output=sample.json
 format=GeoJSON
 Exporting 2 features...
 v.out.ogr complete. 2 features (Point type) written to <sample> (GeoJSON
 format).
 }}}
 2. These are the contents of the file. This is directly created by
 GRASS/GDAL:
 {{{
 GRASS 7.0.3svn (damflood):~/repo > cat sample.json
 {
 "type": "FeatureCollection",
 "crs": { "type": "name", "properties": { "name":
 "urn:ogc:def:crs:OGC:1.3:CRS84" } },
 "features": [
 { "type": "Feature", "properties": { "cat": 1 }, "geometry": { "type":
 "Point", "coordinates": [ -78.690549087210798, 35.769783222348899 ] } },
 { "type": "Feature", "properties": { "cat": 2 }, "geometry": { "type":
 "Point", "coordinates": [ -78.687924462941851, 35.769783222348899 ] } }
 ]
 }
 }}}
 3. I try to import the new `GeoJSON` file using `v.import`, but it is
 failing:
 {{{
 v.import input=/home/grassuser/repo/sample.json output=asdf
 ERROR: Syntax error in cell header
 ERROR: Unable to create location from OGR datasource
 </home/grassuser/repo/sample.json>
 }}}

 4. Importing directly using `v.in.ogr` works without problems:
 {{{
 v.in.ogr input=/home/grassuser/sample.json output=asdf

 Check if OGR layer <OGRGeoJSON> contains polygons...
 Column name <cat> renamed to <cat_>
 Importing 2 features (OGR layer <OGRGeoJSON>)...
 -----------------------------------------------------
 Building topology for vector map <asdf at damflood>...
 Registering primitives...
 2 primitives registered
 2 vertices registered
 Building areas...
 0 areas built
 0 isles built
 Attaching islands...
 Attaching centroids...
 Number of nodes: 0
 Number of primitives: 2
 Number of points: 2
 Number of lines: 0
 Number of boundaries: 0
 Number of centroids: 0
 Number of areas: 0
 Number of isles: 0
 }}}

 5. Trying to create a new location using `v.in.ogr -i` fails. This failure
 is actually the reason that `v.import` fails too (step 3):
 {{{
 v.in.ogr -i --verbose input=/home/grassuser/repo/reservoir_point.json
 output=qwer location=new_location
 Location <new_location> created
 ERROR: Syntax error in cell header
 }}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2878#comment:4>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list