<div dir="ltr"><div class="gmail_quote"><div dir="ltr">вт, 23 окт. 2018 г. в 22:27, Martin Davis <<a href="mailto:mtnclimb@gmail.com">mtnclimb@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That's an interesting use case.  Do you want to split the buildings across isochrones, or can each building just be assigned to a single isochrone?  (I haven't actually looked at the data, so apologies if this is obvious).</div></blockquote><div><br></div><div>I want to split, as this is example benchmarking data. I believe for some other cases population can have a different source dataset, and "complex polygon dataset" that I use isochrones for is user-supplied.</div><div><br></div><div>There are options of converting population to Raster, but it looks like things like (RT_)ST_Intersection vectorize the polygon back and go to GEOS, in their proportional/vector form. Or it there a recipe I missed?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>There are a zillion polygon overlay papers, and some of them even have implementations  8^)   JTS has used monotone chains in overlay since forever... sigh, shoulda published first.   I would guess that there is no significant further breakthrough in that paper.  Franklin's idea of avoiding building topology seems like the big potential win.  Shouldn't be too hard to code up (although needs some indexing and attention to robustness).</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 23, 2018 at 12:06 PM Darafei "Komяpa" Praliaskouski <<a href="mailto:me@komzpa.net" target="_blank">me@komzpa.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Martin, <div><br></div><div>The case for intersections only is the same as 25 years ago: interactively summarize demographics by some area.</div><div><br></div><div>In my benchmarking case I have 33575 buildings with population in metadata and 233597 points in them on one side, and one minute walking isochrones for three hours subdivided into 14642 parts with 5315008 points. I want to have the population proportionally summarized for each walking minute. No spatial viz needed in that case, just numbers.</div><div><br></div><div>Raw sum(ST_Area(geom)) for both layers returns in below 100ms. Something like 500ms for all the operation would be interactive enough. Today I went from 280s to 17s on 8-thread i5.</div><div><br></div><div>If you want to play with the data, here it is temporarily:</div><div><a href="https://www.dropbox.com/s/ixg0ap8m8vpzzux/hackerspace_eta.sqld.gz?dl=0" target="_blank">https://www.dropbox.com/s/ixg0ap8m8vpzzux/hackerspace_eta.sqld.gz?dl=0</a> (614mb)<br></div><div>(all OdBL / from OpenStreetMap, isochrones lead to two spots where Minsk Hackerspace resides).</div><div><br></div><div>Other things I've found today, god bless sci-hub:</div><div><a href="http://sci-hub.tw/https://ieeexplore.ieee.org/document/5380680" target="_blank">http://sci-hub.tw/https://ieeexplore.ieee.org/document/5380680</a> <br></div><div>monotone-chain polygon intersection algorithm from 2009.</div><div><br></div><div>Also, here: <a href="http://codeforces.com/blog/entry/2514" target="_blank">http://codeforces.com/blog/entry/2514</a> ("Darts") they manage to calculate area of union without rebuilding the linework, interesting if it can be adapted to intersection with just one sort of edges.<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">вт, 23 окт. 2018 г. в 21:24, Martin Davis <<a href="mailto:mtnclimb@gmail.com" target="_blank">mtnclimb@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Darafei, what is your use case for needing intersection areas only?  <div><br></div><div>It seems like this should be a common use case in spatial analysis - as long as no spatial visualization of the results are required.  (And if they are, perhaps simply computing an interior point for each resultant would suffice for visualization purposes?  Which should also be amenable to a faster algorithm - perhaps called InteriorPointClipped)</div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr">On Tue, Oct 23, 2018 at 10:02 AM Darafei "Komяpa" Praliaskouski <<a href="mailto:me@komzpa.net" target="_blank">me@komzpa.net</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I have two polygonal layers to intersect and need to measure area of intersections.</div><div><br></div><div>ST_Area(ST_Intersection(a.geom, b.geom)) works fine, but is rather slow. Typical polygon on first side has <10 edges, on second 200..1000 edges.</div><div><br></div><div>What are my options to make it faster? Any ideas, links, experiences to share are welcome.</div><div><br></div><div>For starters, this seems to work faster than vanilla ST_Intersection in my case:</div><div><pre style="font-family:"Courier New""><span style="color:rgb(0,0,128);font-weight:bold">create or replace function </span><span style="font-style:italic">clipped_st_intersection</span>(geom1 <span style="color:rgb(0,0,128);font-weight:bold">geometry</span>, geom2 <span style="color:rgb(0,0,128);font-weight:bold">geometry</span>)<br>  <span style="color:rgb(0,0,128);font-weight:bold">returns geometry<br></span><span style="color:rgb(0,0,128);font-weight:bold">as </span><span style="color:rgb(0,128,0);font-weight:bold">$$</span><span style="color:rgb(0,0,128);font-weight:bold">select </span><span style="font-style:italic">ST_Intersection</span>(<br>              <span style="color:rgb(0,0,128);font-weight:bold">case<br></span><span style="color:rgb(0,0,128);font-weight:bold">                when </span><span style="font-style:italic">ST_MemSize</span>(geom1) > <span style="color:rgb(0,0,255)">160 </span><span style="color:rgb(0,0,128);font-weight:bold">then </span><span style="font-style:italic">ST_ClipByBox2D</span>(geom1, geom2)<br>                <span style="color:rgb(0,0,128);font-weight:bold">else </span>geom1 <span style="color:rgb(0,0,128);font-weight:bold">end</span>, <span style="color:rgb(0,0,128);font-weight:bold">case<br></span><span style="color:rgb(0,0,128);font-weight:bold">                when </span><span style="font-style:italic">ST_MemSize</span>(geom2) > <span style="color:rgb(0,0,255)">160 </span><span style="color:rgb(0,0,128);font-weight:bold">then </span><span style="font-style:italic">ST_ClipByBox2D</span>(geom2, geom1)<br>                <span style="color:rgb(0,0,128);font-weight:bold">else </span>geom2 <span style="color:rgb(0,0,128);font-weight:bold">end</span>)<span style="color:rgb(0,128,0);font-weight:bold">$$<br></span><span style="color:rgb(0,0,128);font-weight:bold">language sql<br></span><span style="color:rgb(0,0,128);font-weight:bold">immutable<br></span><span style="color:rgb(0,0,128);font-weight:bold">strict<br></span><span style="color:rgb(0,0,128);font-weight:bold">parallel safe</span>;</pre></div></div>-- <br><div dir="ltr" class="m_3397293570214400130m_7853372490550255108m_3018356246907746806m_4312706814097261586gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Darafei Praliaskouski<br>Support me: <a href="http://patreon.com/komzpa" target="_blank">http://patreon.com/komzpa</a></div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></blockquote></div>
_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></blockquote></div>-- <br><div dir="ltr" class="m_3397293570214400130m_7853372490550255108gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Darafei Praliaskouski<br>Support me: <a href="http://patreon.com/komzpa" target="_blank">http://patreon.com/komzpa</a></div></div>
_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></blockquote></div>
_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Darafei Praliaskouski<br>Support me: <a href="http://patreon.com/komzpa">http://patreon.com/komzpa</a></div></div>