# Path: base_geoengine/geo_helper/geo_convertion_helper.py
# def value_to_shape(value, use_wkb=False):
# 
# Path: base_geoengine/geo_db.py
# def create_geo_column(
#         cr, tablename, columnname, geotype, srid, dim, comment=None):
#     """ Create a geometry column with the given type.
# 
#     :params: srid: geometry's projection srid
#     :params: dim: geometry's dimension (2D or 3D)
#     """
#     cr.execute("SELECT AddGeometryColumn( %s, %s, %s, %s, %s)",
#                (tablename,
#                 columnname,
#                 srid,
#                 geotype,
#                 dim))
#     if comment:
#         # TODO use SQL string Composition
#         # http://initd.org/psycopg/docs/sql.html
#         # pylint: disable=E8103
#         cr.execute('COMMENT ON COLUMN "{}"."{}" IS %s'.format(
#             tablename, columnname), (comment,))
#     _schema.debug(
#         "Table %r: added geometry column %r of type %s",
#         tablename, columnname, geotype)


import logging
    import geojson
from operator import attrgetter
from odoo import fields, _
from odoo.tools import sql
from .geo_helper import geo_convertion_helper as convert
from .geo_db import create_geo_column
    from shapely.geometry import asShape
    from shapely.geometry import Point
    from shapely.geometry.base import BaseGeometry
    from shapely.wkb import loads as wkbloads
    @property
    def column_format(self):
        return "ST_GeomFromText(%%s, %s)" % (self.srid,)

    @property
    def column_type(self):
        return ('geometry', 'geometry')

    _slots = {
        'dim': 2,
        'srid': 3857,
        'gist_index': True,
    }

    def convert_to_column(self, value, record, values=None):
        """Convert value to database format

        value can be geojson, wkt, shapely geometry object.
        If geo_direct_write in context you can pass diretly WKT"""
        if not value:
            return None
        shape_to_write = self.entry_to_shape(value, same_type=True)
        if shape_to_write.is_empty:
            return None
        else:
            return shape_to_write.wkt

    def convert_to_cache(self, value, record, validate=True):
        val = value
        if isinstance(value, BaseGeometry):

# Path: base_geoengine/geo_helper/geo_convertion_helper.py
# def value_to_shape(value, use_wkb=False):
# 
# Path: base_geoengine/geo_db.py
# def create_geo_column(
#         cr, tablename, columnname, geotype, srid, dim, comment=None):
#     """ Create a geometry column with the given type.
# 
#     :params: srid: geometry's projection srid
#     :params: dim: geometry's dimension (2D or 3D)
#     """
#     cr.execute("SELECT AddGeometryColumn( %s, %s, %s, %s, %s)",
#                (tablename,
#                 columnname,
#                 srid,
#                 geotype,
#                 dim))
#     if comment:
#         # TODO use SQL string Composition
#         # http://initd.org/psycopg/docs/sql.html
#         # pylint: disable=E8103
#         cr.execute('COMMENT ON COLUMN "{}"."{}" IS %s'.format(
#             tablename, columnname), (comment,))
#     _schema.debug(
#         "Table %r: added geometry column %r of type %s",
#         tablename, columnname, geotype)


# Path: base_geoengine/fields.py
import logging
    import geojson
from operator import attrgetter
from odoo import fields, _
from odoo.tools import sql
from .geo_helper import geo_convertion_helper as convert
from .geo_db import create_geo_column
    from shapely.geometry import asShape
    from shapely.geometry import Point
    from shapely.geometry.base import BaseGeometry
    from shapely.wkb import loads as wkbloads

    @property
    def column_format(self):
        return "ST_GeomFromText(%%s, %s)" % (self.srid,)

    @property
    def column_type(self):
        return ('geometry', 'geometry')

    _slots = {
        'dim': 2,
        'srid': 3857,
        'gist_index': True,
    }

    def convert_to_column(self, value, record, values=None):
        """Convert value to database format

        value can be geojson, wkt, shapely geometry object.
        If geo_direct_write in context you can pass diretly WKT"""
        if not value:
            return None
        shape_to_write = self.entry_to_shape(value, same_type=True)
        if shape_to_write.is_empty:
            return None
        else:
            return shape_to_write.wkt

    def convert_to_cache(self, value, record, validate=True):
        val = value
        if isinstance(value, BaseGeometry):

            val = value.wkb_hex