# PostGIS ST_MakeEnvelope size direction change on geography

This doesn't really effect me but I was just wondering if you find this a little bit strange or not. I think this issue is probably cause of this question also but I think the accepted answer does not apply to my question.

I am using ST_MakeEnvelope and it tax `xmin`,`ymin`,`xmax`,`ymax` values as arguments.

I realized that for example, if longitude distance is over 180 degrees, it seems to wrap around other way around (That is what I think is happening, I may be wrong?).

I thought it would always go from `xmin` to `xmax`. As in `xmin=-81` to `xmax=100` should go in direction `-81,-80,-79...0,1...100` , yet it seems to make a boundary box going other way `-81,-82,-83...(+/–)180,179...100`

Am I imagining things and is this suppose to work like this? Any reason why this way is better than always assuming we should travel from `xmin` to `xmin+` direction?

``````SELECT tbl1.column1, tbl2.column1, tbl1.column2 && tbl2.column2 AS overlaps FROM
( VALUES
(1, 'POINT(0 0)'::geography),
(2, 'POINT(-85 0)'::geography) ) AS tbl1,
( VALUES
(3, ST_MakeEnvelope(-80, -10, 100, 20, 4326)::geography),
(4, ST_MakeEnvelope(-81, -10, 100, 20, 4326)::geography)) AS tbl2;
``````

Results in:

`````` column1 | column1 | overlaps
---------+---------+----------
1 |       3 | t
1 |       4 | f
2 |       3 | f
2 |       4 | t
``````
• – JGH
Nov 27, 2017 at 1:37
• Antipodal distances are usually either an error or wrapped the great circle direction. Nov 27, 2017 at 2:55
• @JGH yes, I think that issue you linked seems to share the same background. @Vince The question is why function has `xmin`,`xmax` arguments yet it is designed to chose smallest area and if this is desired behavior or a bug, and if it is desired why? Nov 27, 2017 at 5:46