bosth / plpygis Goto Github PK
View Code? Open in Web Editor NEWPL/Python for PostGIS
Home Page: https://vimeo.com/248099711
License: GNU General Public License v3.0
PL/Python for PostGIS
Home Page: https://vimeo.com/248099711
License: GNU General Public License v3.0
When executing a function defined like below, getting 'cannot import name 'Geometry''
`CREATE OR REPLACE FUNCTION cc_s2sphere_cell_id(pnt geometry)
RETURNS text AS
import s2sphere
from plpygis import Geometry
point = Geometry(pnt)`
I have a pretty simple function that returns a custom type of s2_cell. When calling the function, I get a seg fault on the database and it goes into recovery mode. This used to work, possibly newer versions of debian? Not sure how to proceed in testing. I have manually gone into a python console and not had any issues, but from within plpython3u I get the error. This is on the postgis docker images for FROM postgis/postgis:14-3.1 and also FROM postgis/postgis:13-3.1
`CREATE OR REPLACE FUNCTION public.cc_s2_intersection_cells_at_level(_geom geometry, lvl integer)
RETURNS SETOF s2_cell
LANGUAGE plpython3u
AS
import plpygis
`
Thank you for this useful library.
Currently, in order to get the actual wkb representation of an object, one has to do:
bytes.fromhex(geo.wkb)
It would be both more efficient and more intuitive if geo.wkb
contained directly the Well-Known Binary representation of the geometry. The string representation of the wkb could still be obtained with :
geo.wkb.hex()
What do you think about this change ? Would you be opened to a pull request ?
๐ @bosth
First thanks for this great module. We are using it in https://github.com/stac-utils/pgstac and it has been really useful.
One thing we just noticed is that the pypi package contains the .pyc
files which are not cross version safe and could lead to some issues.
While working on #1, I found a bug in the existing code: https://github.com/bosth/plpygis/blob/master/plpygis/geometry.py#L194-L195
Reader
should be HexReader
.
This can be triggered with
Geometry("000000000100000000000000000000000000000000")
which raises
Error
Traceback (most recent call last):
...
File ".../plpygis/plpygis/geometry.py", line 195, in _from_wkb
reader = Reader(wkb, ">") # big-endian reader
NameError: name 'Reader' is not defined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.