How to use the geoalchemy2.WKTElement function in GeoAlchemy2

To help you get started, we’ve selected a few GeoAlchemy2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geoadmin / 3d-forge / forge / View on Github external'Action: populateTables()')
        session = scoped_session(sessionmaker(bind=self.userEngine))
        for model in models:
            count = 1
            shpFiles = model.__shapefiles__
            for shpFile in shpFiles:
                if not os.path.exists(shpFile):
                    self.logger.error('Shapefile %s does not exists' % shpFile)
                features = ShpToGDALFeatures(shpFile).__read__()
                bulk = BulkInsert(model, session, withAutoCommit=1000)
                for feature in features:
                    polygon = feature.GetGeometryRef()
                        the_geom=WKTElement(polygon.ExportToWkt(), 4326)
                    count += 1
      'Commit features for %s.' % shpFile)'All tables have been created.')
github jet-admin / jet-bridge / packages / jet_bridge_base / jet_bridge_base / fields / View on Github external
def to_internal_value_item(self, value):
        if value is None:
        from geoalchemy2 import ArgumentError, WKTElement
            return WKTElement(value)
        except ArgumentError as e:
            self.error('invalid', error=six.text_type(e))
github ibis-project / ibis / ci / View on Github external
                lambda x: WKTElement(x, srid=srid)
github lbud / run_sf / utils / View on Github external
def store_intersection(id, ints, lat, lon, elev):
    """ Store intersections in DB """
    loc = 'POINT(%r %r)' % (lon, lat)
    i = GIntersection(
        id=id, ints=ints, lat=lat, lon=lon, loc=WKTElement(loc, srid=4326),
    return None
github GeoGuideProject / geoguide / geoguide / server / geoguide / View on Github external
        df['geom'] = df.apply(lambda r: WKTElement('POINT({} {})'.format(r[dataset.longitude_attr], r[dataset.latitude_attr])), axis=1)
        df.to_sql(table_name, engine, if_exists='append', index_label='geoguide_id', chunksize=CHUNKSIZE, dtype={'geom': Geometry('POINT')})