[postgis-devel] [postgis-users] PostGIS case usages

Nicklas Avén nicklas.aven at jordogskog.no
Tue Oct 30 09:55:54 PDT 2018


To save someone some time.
The function I use to serve the example I posted earlier looks like
this:
CREATE OR REPLACE FUNCTION map.roads(minx double precision, miny double
precision, maxx double precision, maxy double precision) RETURNS
jsonb LANGUAGE plpgsql STABLE SECURITY DEFINERAS $function$beginreturn
jsonb_build_object('type','FeatureCollection','features',jsonb_agg(json
b_build_object('type','Feature','id',ogc_fid,'geometry',public.st_asgeo
json(wkb_geometry,0)::jsonb,
'properties',jsonb_build_object('kategori', kategori, 'code',kkod))))
from data.roads where wkb_geometry operator(public.&&)
public.ST_SetSRID(public.ST_MakeBox2D(public.ST_Point(minx,
miny),public.ST_Point( maxx,maxy)),3857);end$function$

Postrgest sets the search_path so all PostGIS functions and operators
must be schema qualified. Took me some time to find out how to schema-
qualify an operator.
/Nicklas
On Tue, 2018-10-30 at 17:49 +0100, Nicklas Avén wrote:
> I haven't touched or looked at the Haskel code to be honest.
> 
> The real work is done by PostgreSQL as I understand.
> 
> I have used it a couple of times the last maybe 3 years, and I think
> it has matured quite a lot. 
> From a user perspective the documentation is better now.
> 
> It had some issue some years ago with the garbage collector causing
> the cpu to go wild without load.
> But since they fixed that it has just worked.
> 
> What I really like is that it is an easy way to use multiple database
> roles from an api. 
> 
> We have a case where we have automated the jwt token creation and
> from that we can assign resources to a user through the database
> role.
> 
> I am not a json or geojson fan, but when there is a need it is very
> nice to have a thin middle ware.
> When it is setup all customization and changes of the api is done in
> the db, which I like :-)
> 
> And the api gets separated from the data by publishing schemas with
> only views and functions in. Never the tables.
> 
> /Nicklas
> 
> 
> On Tue, 2018-10-30 at 09:21 -0700, Paul Ramsey wrote:
> > On Tue, Oct 30, 2018 at 12:34 AM Nicklas Avén <nicklas.aven at jordogs
> > kog.no> wrote:
> > > A simple but very powerful combination of tools I use quite a lot
> > > is
> > > 
> > > PostgreSQL/PostGIS and postgREST (http://postgrest.org)
> > 
> > Any issues w/ the fact that it's written in haskell? I kind of shy
> > away from things in super niche languages... how's your experience?
> > 
> > P
> > 
> > 
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/postgis-devel
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20181030/4001cfc6/attachment.html>


More information about the postgis-devel mailing list