<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div>Yes Arnold, I fully agree.<div class=""><br class=""></div><div class="">SELECT AREA(INTERSECTION(region1, region2))&nbsp;</div><div class=""><br class=""></div><div class="">is indeed what we want. Much more flexible.</div><div class="">Let me then rephrase my request:</div><div class=""><br class=""></div><div class="">Can we add in ADQL an INTERSECTION function</div><div class="">which returns the polygon intersection of two regions?</div><div class=""><br class=""></div><div class="">Alberto</div><div class="">PS: We did try the INTERSECTION way, but a problem with the underlying library stopped us.</div><div class="">Our user-defined function returned a value whose type was interpreted as UNKNOWN</div><div class="">instead of REGION by that library, and that is why we went for a function</div><div class="">that computed the area of the intersection of the two input regions instead.</div><div class="">Much more inflexible indeed, though that solved our immediate problem.</div><div class="">Sorry to have been sidetracked by what is only a library issue!</div><div class="">Thanks Arnold!</div><div class=""><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 07 Jun 2017, at 19:29, Arnold Rots &lt;<a href="mailto:arots@cfa.harvard.edu" class="">arots@cfa.harvard.edu</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class="">I was going to ask: doesn't it make more sense to define two functions:<br class=""></div>1. return the intersection of two regions<br class=""></div>2. return the area of a region<br class=""></div>The combination of the two provides Alberto's area of the intersection<br class=""></div>and separately they provide more functionality.<br class=""></div>One might of course want to add:<br class=""></div>3. return the union of two regions<br class=""><br class=""></div>Cheers,<br class=""><br class=""></div>&nbsp; - Arnold<br class=""></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">-------------------------------------------------------------------------------------------------------------<br class="">Arnold H. Rots&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Chandra X-ray Science Center<br class="">Smithsonian Astrophysical Observatory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tel:&nbsp; +1 617 496 7701<br class="">60 Garden Street, MS 67&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; fax:&nbsp; +1 617 495 7356<br class="">Cambridge, MA 02138&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <a href="mailto:arots@cfa.harvard.edu" target="_blank" class="">arots@cfa.harvard.edu</a><br class="">USA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://hea-www.harvard.edu/~arots/" target="_blank" class="">http://hea-www.harvard.edu/~arots/</a><br class="">--------------------------------------------------------------------------------------------------------------<br class=""><br class=""></div></div></div>
<br class=""><div class="gmail_quote">On Wed, Jun 7, 2017 at 1:15 PM, Walter Landry <span dir="ltr" class="">&lt;<a href="mailto:wlandry@caltech.edu" target="_blank" class="">wlandry@caltech.edu</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">alberto micol &lt;<a href="mailto:amicol.ivoa@googlemail.com" class="">amicol.ivoa@googlemail.com</a>&gt; wrote:<br class="">
&gt; Dear All,<br class="">
</span>&gt; cc: Bruno, for the Standing Committee on Science Priorities &lt;<a href="http://wiki.ivoa.net/twiki/bin/view/IVOA/IvoaSciencePriorities" rel="noreferrer" target="_blank" class="">http://wiki.ivoa.net/twiki/<wbr class="">bin/view/IVOA/<wbr class="">IvoaSciencePriorities</a>&gt;<br class="">
<span class="">&gt;<br class="">
&gt; The following science use case cannot be accomplished without a new ADQL function:<br class="">
&gt;<br class="">
&gt; I want to find images of the Galactic Centre in two bands (J and H) provided that the images<br class="">
&gt; in the 2 bands overlap, in order to get the colours (J-H) of the sources imaged by both.<br class="">
&gt; The overlapping region must be big enough so that I can detect sources<br class="">
&gt; in both images: an overlap of, say, 0.001 square degrees would be irrelevant for my science case.<br class="">
&gt;<br class="">
&gt; I’ll show in the PS how this can be achieved using ObsCore with a user-defined function.<br class="">
&gt;<br class="">
&gt; The issue is that, to avoid images just “touching” each other, we had to create a user-defined function<br class="">
&gt; that computes the area of the intersection of the two regions.<br class="">
&gt;<br class="">
&gt; Issues: (1) only those users that read the documentation or the TAPRegExt will know<br class="">
&gt; that such functionality exists, and (2) this function cannot be used when querying other data centres.<br class="">
&gt;<br class="">
&gt; Can I suggest to introduced a new function in ADQL 2.1 which can be used to compute<br class="">
&gt; the area of the intersections between two regions?<br class="">
<br class="">
</span>It sounds like what you actually want is the distance to the edge, not<br class="">
the overlap area.&nbsp; I needed something like that.&nbsp; We wanted the "most<br class="">
centered" image, so we sort results by the distance to the edge.&nbsp; It<br class="">
required a bit of hacking on our end.<br class="">
<br class="">
With that said, I am not a fan of new functions that can not be<br class="">
implemented via simple rewriting on GIS backends.<br class="">
<br class="">
Cheers,<br class="">
Walter Landry<br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></div></div></body></html>