wkb

Inserting and selecting PostGIS Geometry with Gorm

早过忘川 提交于 2020-05-25 17:12:11
问题 I've been trying to find a way to insert and retrieve geometric types using Golang, and specifically the library gorm. I'm also attempting to use the library orb that defines different types for geometries, and provides encoding/decoding between different formats. Orb has Scan() and Value() methods already implemented for each type. This allows go's Insert() and Scan() functions to work with types other than primitives. Orb expects however to be using geometry represented in the well-known

GeoAlchemy2: Get the lat, lon of a point

妖精的绣舞 提交于 2019-12-22 13:44:08
问题 Consider the following SQLAalchemy / GeoAlchemy2 ORM with a geometry field: from geoalchemy2 import Geometry, WKTElement class Item(Base): __tablename__ = 'item' id = Column(Integer, primary_key=True) ... geom = Column(Geometry(geometry_type='POINTZ', srid=4326)) When I update an item in the PostgreSQL shell: UPDATE item SET geom = st_geomFromText('POINT(2 3 0)', 4326) WHERE id = 5; Fetching the field: items = session.query(Item).\ filter(Item.id == 3) for item in items: print item.geom Gives

GeoAlchemy2: Get the lat, lon of a point

て烟熏妆下的殇ゞ 提交于 2019-12-06 05:41:14
Consider the following SQLAalchemy / GeoAlchemy2 ORM with a geometry field: from geoalchemy2 import Geometry, WKTElement class Item(Base): __tablename__ = 'item' id = Column(Integer, primary_key=True) ... geom = Column(Geometry(geometry_type='POINTZ', srid=4326)) When I update an item in the PostgreSQL shell: UPDATE item SET geom = st_geomFromText('POINT(2 3 0)', 4326) WHERE id = 5; Fetching the field: items = session.query(Item).\ filter(Item.id == 3) for item in items: print item.geom Gives: 01e9030000000000000000004000000000000008400000000000000000 This isn't a proper WKB - at least, it

What's the “E” before a Postgres string?

£可爱£侵袭症+ 提交于 2019-12-04 02:46:45
问题 I was reading a Postgres/PostGIS statement like this: SELECT ST_AsBinary( ST_GeomFromWKB( E'\\001\\001\\000\\000\\000\\321\\256B\\312O\\304Q\\300\\347\\030\\220\\275\\336%E@', 4326 ) ); The above creates something from a Well Known Binary (WKB). I haven't seen the specific way of quoting here where the string is single quoted with a E preceding the beginning quote. What is this format called? And what are the formatting rules for this? e.g. is the 336%E@ at the very end special or just some