<div dir="ltr">Yup, if you really want to support DISTINCT on box2d implicitly, I think, you may need to create below by yourself:<div><br></div><div><font face="monospace, monospace">CREATE FUNCTION box2d_lt (b1 box2d, b2 box2d) ...</font></div><div><font face="monospace, monospace">CREATE FUNCTION box2d_gt (b1 box2d, b2 box2d) ...<br></font></div><div><font face="monospace, monospace">CREATE FUNCTION box2d_eq (b1 box2d, b2 box2d) ...<br></font></div><div><font face="monospace, monospace">CREATE FUNCTION box2d_ge (b1 box2d, b2 box2d) ...<br></font></div><div><font face="monospace, monospace">CREATE FUNCTION box2d_le (b1 box2d, b2 box2d) ...<br></font></div><div><font face="monospace, monospace">CREATE FUNCTION box2d_cmp (b1 box2d, b2 box2d) ...<br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">CREATE OPERATOR < ( leftarg = box2d, rightarg = box2d, procedure = box2d_lt, commutator = '>', negator = '>=' ....)</font></div><div><font face="monospace, monospace">CREATE OPERATOR > ( leftarg = box2d, rightarg = box2d, procedure = box2d_lt, commutator = '<', negator = '<=' ....)</font></div><div><font face="monospace, monospace">...</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">CREATE OPERATOR CLASS box2d_ops ... OPERATOR 1 <, OPERATOR 2 >, ....;</font></div><div><br></div><div><br></div><div>Then you can DISTINCT, ORDER BY, GROUP BY on box2d.</div><div><br></div><div>PS: casting box2d to geometry before calling DISTINCT seems a doable way to bypass this issue. Right?</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Cheers,<div>Kuien Liu</div></div></div></div>
<br><div class="gmail_quote">On Wed, Apr 22, 2015 at 1:26 PM, Nick Ves <span dir="ltr"><<a href="mailto:vesnikos@gmail.com" target="_blank">vesnikos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ah yes thank you for clearing that up. The = Operator is valid for those type.<br>
<br>
Strange thing is that box2d type DOES support the = Operator while<br>
st_box2d does not.<br>
<br>
A quick search in gis.SE forums gives a post [0] from a user stating<br>
that st_box2d is deprecated? Is that the case?<br>
<br>
[0] <a href="http://gis.stackexchange.com/questions/56818/st-box2d-in-postgis-2-0" target="_blank">http://gis.stackexchange.com/questions/56818/st-box2d-in-postgis-2-0</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Apr 21, 2015 at 1:24 PM, Kuien Liu <<a href="mailto:kliu@pivotal.io">kliu@pivotal.io</a>> wrote:<br>
> thanks, got it. Surely you may meet this issue, distinct cannot find the<br>
> 'OPERATOR =' for data type 'box2d'.<br>
><br>
> PostGIS only supports 3 kinds of OPERATOR =, i.e.,<br>
><br>
> OPERATOR =  (geometry,geometry)<br>
> OPERATOR =  (geography,geography)<br>
> OPERATOR =  (raster,raster)<br>
><br>
> Maybe we can try these ways:<br>
><br>
> cast box2d to geometry: select distinct st_extent(the_geom)::geometry from<br>
> test;<br>
> create ordering operator for box2d.<br>
><br>
><br>
> Cheers,<br>
> Kuien Liu<br>
><br>
> On Tue, Apr 21, 2015 at 6:06 PM, Nick Ves <<a href="mailto:vesnikos@gmail.com">vesnikos@gmail.com</a>> wrote:<br>
>><br>
>> On Tue, Apr 21, 2015 at 12:50 PM, Kuien Liu <<a href="mailto:kliu@pivotal.io">kliu@pivotal.io</a>> wrote:<br>
>> > I'm not sure I understand what your query really looks like, but I can<br>
>> > run<br>
>> > query below.<br>
>><br>
>> try this one:<br>
>><br>
>> select distinct st_extent(the_geom) over () from test;<br>
>><br>
>><br>
>> > gis=# SELECT ST_GeometryType(ST_Extent(the_geom))='ST_Polygon' FROM test<br>
>> > WHERE num < 10;<br>
>> >  ?column?<br>
>> > ----------<br>
>> >  true<br>
>> > (1 row)<br>
>> ><br>
>> > where the table 'test' contains 50,000 points.<br>
>> ><br>
>> > Wish this helps to you.<br>
>> ><br>
>> > Cheers,<br>
>> > Kuien Liu<br>
>> ><br>
>> > On Tue, Apr 21, 2015 at 4:58 PM, Nick Ves <<a href="mailto:vesnikos@gmail.com">vesnikos@gmail.com</a>> wrote:<br>
>> >><br>
>> >> I was playing with the ST_Extent today and I wanted to try a query like<br>
>> >> this:<br>
>> >><br>
>> >> select distinct ST_Extent(geom)  over () box from parcels_test<br>
>> >><br>
>> >> where the geom is Type ST_Polygon but I got this error instead:<br>
>> >><br>
>> >>   ERROR:  could not identify an equality operator for type box2d<br>
>> >><br>
>> >> The aim was to get the BBox from a set of polygons that might or might<br>
>> >> not be adjutant. Ofc you can get the same results by limit the result<br>
>> >> to 1 but, it hitted me strange box2d type not having an equal operator<br>
>> >><br>
>> >> using "POSTGIS="2.1.4 r12966" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel.<br>
>> >> 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24"<br>
>> >> LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER"<br>
>> >> _______________________________________________<br>
>> >> postgis-users mailing list<br>
>> >> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
>> >> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > postgis-users mailing list<br>
>> > <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
>> > <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
>> _______________________________________________<br>
>> postgis-users mailing list<br>
>> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
>> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div>