Skip to main content
Forgotten import
Source Link
Francis
  • 967
  • 7
  • 19

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

import ogr
import numpy as np
import os 
DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

import ogr
import numpy as np
DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

import ogr
import numpy as np
import os 
DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()
added imports used
Source Link
Francis
  • 967
  • 7
  • 19

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

import ogr
import numpy as np
DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

import ogr
import numpy as np
DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()
naming
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

GDAL SQLITESQLite geometry error

I am having the following issue writing points to a SQLITESQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()

GDAL SQLITE geometry error

I am having the following issue writing points to a SQLITE file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()

GDAL SQLite geometry error

I am having the following issue writing points to a SQLite file using ogr with SPATIALITE enabed:

ERROR 1: Cannot insert feature with geometry of type POINTZ in column GEOMETRY. Type POINT expected

Below is my code, this code was previously used to create a GeoPackage with exactly the same fields. (But not with Spatialite enabled because it doesn't have it)

I have commented the code to indicate where the point is created and where the error message comes up

DataSource= ogr.GetDriverByName("SQLite").CreateDataSource(os.path.join(OutputFolder,"DataFile.sqlite"), options = ["SPATIALITE=YES"])
DataLayer = DataSource.CreateLayer("Data_Points",proj,geom_type=ogr.wkbPoint)

DataLayer.CreateField(ogr.FieldDefn('ID',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('buffer_dist',ogr.OFTInteger64))
DataLayer.CreateField(ogr.FieldDefn('arr_id',ogr.OFTInteger64))

Data_layer_defn = DataLayer.GetLayerDefn()
DataSource.StartTransaction()


data = np.load(os.path.join(OutputFolder,"Output0.npy"))
arr_id = 0
for row in range(len(data)):


    point = ogr.Geometry(ogr.wkbPoint)
    point.AddPoint(float(data[row,1]),float(data[row,2])) #x,y Setting the point

    Data_Feature = ogr.Feature(Data_layer_defn)
    Data_Feature.SetField("ID", int(data[row,0]))
    Data_Feature.SetField("buffer_dist", int(data[row,3]))
    Data_Feature.SetField("arr_id", arr_id)
    Data_Feature.SetGeometry(point)
    DataLayer.CreateFeature(Data_Feature) #Error message happens on this line

    point = None
    arr_id +=1

DataSource.CommitTransaction()
DataSource.FlushCache()
Source Link
Francis
  • 967
  • 7
  • 19
Loading