<div dir="ltr"><div>> It will be interesting to see novel Python functions in PostGIS.</div><div><br></div><div>Server side?</div><div><br></div><div>1. Postgis Raster see</div><div> "11.3.4. Use PLPython to dump out images via SQL" </div><div> <a href="https://postgis.net/docs/using_raster_dataman.html">https://postgis.net/docs/using_raster_dataman.html</a></div><div><br><div>2.) book: "PostGIS-Cookbook" <a href="https://www.packtpub.com/product/postgis-cookbook-second-edition/9781788299329">https://www.packtpub.com/product/postgis-cookbook-second-edition/9781788299329</a></div><div> - "Writing PostGIS functions with PL/Python"<br></div><div> <a href="https://github.com/PacktPublishing/PostGIS-Cookbook-Second-Edition/blob/master/Chapter08/code%20snippets/chp08_R4.sql">https://github.com/PacktPublishing/PostGIS-Cookbook-Second-Edition/blob/master/Chapter08/code%20snippets/chp08_R4.sql</a></div><div> - "Geocoding with geopy and PL/Python" <br></div><div> <a href="https://github.com/PacktPublishing/PostGIS-Cookbook-Second-Edition/blob/master/Chapter08/code%20snippets/chp08_R7.sql">https://github.com/PacktPublishing/PostGIS-Cookbook-Second-Edition/blob/master/Chapter08/code%20snippets/chp08_R7.sql</a></div><div><br></div></div><div>3.) The plpygis has some simple examples: <a href="https://plpygis.readthedocs.io/en/latest/examples.html">https://plpygis.readthedocs.io/en/latest/examples.html</a></div><div><font face="times new roman, serif">"<code class="gmail-docutils gmail-literal gmail-notranslate" style="font-size:0.9em;background-color:rgb(236,240,243)"><span class="gmail-pre" style="hyphens: none;">plpygis</span></code><span style="color:rgb(62,67,73);font-size:17px"> is a Python conveter to and from the PostGIS </span><code class="gmail-docutils gmail-literal gmail-notranslate" style="font-size:0.9em;background-color:rgb(236,240,243)"><span class="gmail-pre" style="hyphens: none;">geometry</span></code><span style="color:rgb(62,67,73);font-size:17px"> type, WKB, EWKB, GeoJSON and Shapely geometries and additionally supports </span><code class="gmail-docutils gmail-literal gmail-notranslate" style="font-size:0.9em;background-color:rgb(236,240,243)"><span class="gmail-pre" style="hyphens: none;">__geo_interface__</span></code><span style="color:rgb(62,67,73);font-size:17px">. </span><code class="gmail-docutils gmail-literal gmail-notranslate" style="font-size:0.9em;background-color:rgb(236,240,243)"><span class="gmail-pre" style="hyphens: none;">plpygis</span></code><span style="color:rgb(62,67,73);font-size:17px"> is intended for use in PL/Python functions."</span></font><br></div><div>see more: </div><div>- <a href="https://plpygis.readthedocs.io/en/latest/">https://plpygis.readthedocs.io/en/latest/</a><span style="color:rgb(62,67,73);font-family:Georgia,serif;font-size:17px"><br></span></div><div>- <a href="https://github.com/bosth/plpygis">https://github.com/bosth/plpygis</a><br></div><div>- slide ( 2017 ) <a href="https://2017.foss4g.org/post_conference/Extending-PostGIS-with-Python.pdf">https://2017.foss4g.org/post_conference/Extending-PostGIS-with-Python.pdf</a></div><div><br></div><div>4.) CartoDB is also plpythonu based.</div><div>- <a href="https://github.com/search?q=repo%3ACartoDB%2Fcartodb+plpython&type=code">https://github.com/search?q=repo%3ACartoDB%2Fcartodb+plpython&type=code</a><br></div><div>- crankshaft ( CARTO Spatial Analysis extension for PostgreSQL ) <a href="https://github.com/CartoDB/crankshaft">https://github.com/CartoDB/crankshaft</a></div><div><br></div><div>5.) (tutorial) Map Matching in PostGIS with Valhalla and PL/Python</div><div><a href="https://gis-ops.com/map-matching-postgis-plpython/">https://gis-ops.com/map-matching-postgis-plpython/</a><br></div><div><br></div><div>6.) Apache MADlib ( Graph, Deep learning, Statistics, .. ) </div><div><a href="https://madlib.apache.org/docs/latest/index.html">https://madlib.apache.org/docs/latest/index.html</a> ( mostly plpythonu based ) <br></div><div><br></div><div>....</div><div><br></div><div>Be careful:<br></div><div><i>"<span style="color:rgb(0,0,0);font-family:"Open Sans",sans-serif;font-size:14.4px">PL/Python is only available as an </span><span class="gmail-quote" style="box-sizing:border-box;color:rgb(0,0,0);font-family:"Open Sans",sans-serif;font-size:14.4px">“<span class="gmail-quote" style="box-sizing:border-box">untrusted</span>”</span><span style="color:rgb(0,0,0);font-family:"Open Sans",sans-serif;font-size:14.4px"> language, meaning it does not offer any way of restricting what users can do in it and is therefore named </span><code class="gmail-literal" style="box-sizing:border-box;font-family:monospace,monospace;font-size:14.4px;color:rgb(0,0,0);border-radius:0.25rem;margin:0.6rem 0px">plpython3u</code><span style="color:rgb(0,0,0);font-family:"Open Sans",sans-serif;font-size:14.4px">. A trusted variant </span><code class="gmail-literal" style="box-sizing:border-box;font-family:monospace,monospace;font-size:14.4px;color:rgb(0,0,0);border-radius:0.25rem;margin:0.6rem 0px">plpython</code><span style="color:rgb(0,0,0);font-family:"Open Sans",sans-serif;font-size:14.4px"> might become available in the future if a secure execution mechanism is developed in Python. The writer of a function in untrusted PL/Python must take care that the function cannot be used to do anything unwanted, since it will be able to do anything that could be done by a user logged in as the database administrator. Only superusers can create functions in untrusted languages such as </span><code class="gmail-literal" style="box-sizing:border-box;font-family:monospace,monospace;font-size:14.4px;color:rgb(0,0,0);border-radius:0.25rem;margin:0.6rem 0px">plpython3u</code><span style="color:rgb(0,0,0);font-family:"Open Sans",sans-serif;font-size:14.4px">."</span></i></div><div><a href="https://www.postgresql.org/docs/15/plpython.html">https://www.postgresql.org/docs/15/plpython.html</a><br></div><div><a href="https://dba.stackexchange.com/questions/132352/why-is-pl-python-untrusted">https://dba.stackexchange.com/questions/132352/why-is-pl-python-untrusted</a><br></div><div><br></div><div><br></div><div>Regards,</div><div> Imre</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Shaozhong SHI <<a href="mailto:shishaozhong@gmail.com">shishaozhong@gmail.com</a>> ezt írta (időpont: 2022. dec. 3., Szo, 21:59):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It will be interesting to see novel Python functions in PostGIS.<div><br></div><div>Regards,</div><div>David</div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
</blockquote></div>