<html><head></head><body><div>To save someone some time.</div><div><br></div><div>The function I use to serve the example I posted earlier looks like this:</div><div><br></div><div>CREATE OR REPLACE FUNCTION map.roads(minx double precision, miny double precision, maxx double precision, maxy double precision)</div><div> RETURNS jsonb</div><div> LANGUAGE plpgsql</div><div> STABLE SECURITY DEFINER</div><div>AS $function$</div><div>begin</div><div>return jsonb_build_object('type','FeatureCollection','features',jsonb_agg(jsonb_build_object('type','Feature','id',ogc_fid,'geometry',public.st_asgeojson(wkb_geometry,0)::jsonb, 'properties',jsonb_build_object('kategori', kategori, 'code',kkod)))) from data.roads </div><div>where wkb_geometry operator(public.&&) public.ST_SetSRID(public.ST_MakeBox2D(public.ST_Point(minx, miny),public.ST_Point( maxx,maxy)),3857)</div><div>;</div><div>end</div><div>$function$</div><div><br></div><div><br></div><div>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.</div><div><br></div><div>/Nicklas</div><div><br></div><div>On Tue, 2018-10-30 at 17:49 +0100, Nicklas Avén wrote:</div><blockquote type="cite"><div><br></div><div><br></div><div>I haven't touched or looked at the Haskel code to be honest.</div><div><br></div><div>The real work is done by PostgreSQL as I understand.</div><div><br></div><div>I have used it a couple of times the last maybe 3 years, and I think it has matured quite a lot. </div><div>From a user perspective the documentation is better now.</div><div><br></div><div>It had some issue some years ago with the garbage collector causing the cpu to go wild without load.</div><div>But since they fixed that it has just worked.</div><div><br></div><div>What I really like is that it is an easy way to use multiple database roles from an api. </div><div><br></div><div>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.</div><div><br></div><div>I am not a json or geojson fan, but when there is a need it is very nice to have a thin middle ware.</div><div>When it is setup all customization and changes of the api is done in the db, which I like :-)</div><div><br></div><div>And the api gets separated from the data by publishing schemas with only views and functions in. Never the tables.</div><div><br></div><div>/Nicklas</div><div><br></div><div><br></div><div>On Tue, 2018-10-30 at 09:21 -0700, Paul Ramsey wrote:</div><blockquote type="cite"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 30, 2018 at 12:34 AM Nicklas Avén <<a href="mailto:nicklas.aven@jordogskog.no">nicklas.aven@jordogskog.no</a>> wrote:<br></div><blockquote type="cite"><br>
A simple but very powerful combination of tools I use quite a lot is<br>
PostgreSQL/PostGIS and postgREST (<a href="http://postgrest.org" rel="noreferrer" target="_blank">http://postgrest.org</a>)<br></blockquote><div><br></div><div>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?</div><div><br></div><div>P<br></div></div></div>
<pre>_______________________________________________
postgis-devel mailing list
<a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></pre></blockquote><pre>_______________________________________________
postgis-devel mailing list
<a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></pre></blockquote></body></html>