ST_Transform behavior

42 views
Skip to first unread message

marcelo...@ifood.com.br

unread,
Jun 28, 2018, 5:49:23 PM6/28/18
to GeoSpark Discussion Board

I recently noticed that `ST_Transform` is throwing errors on latitude too close to the pole. For some reason, this is happening due to a confusing behavior concerning latitude and longitude order. In theory `ST_Transforms` expects X = longitude and Y = latitude, as stated here, but the in practice it is considering X = latitude and Y = longitude. The optional boolean arguments to force the behavior seems not to work. I am reading the polygons from WKB, so swap latitude and longitude is not feasible. Is there any way to bypass this odd behavior?

Jia Yu

unread,
Jun 28, 2018, 5:51:23 PM6/28/18
to marcelo...@ifood.com.br, GeoSpark Discussion Board
Hi Marcelo,


It is easy to bypass this.

Thanks,
Jia

------------------------------------

Jia Yu,

Ph.D. Student in Computer Science



On Thu, Jun 28, 2018 at 2:49 PM marcelo.rabello via GeoSpark Discussion Board <geospark-dis...@googlegroups.com> wrote:

I recently noticed that `ST_Transform` is throwing errors on latitude too close to the pole. For some reason, this is happening due to a confusing behavior concerning latitude and longitude order. In theory `ST_Transforms` expects X = longitude and Y = latitude, as stated here, but the in practice it is considering X = latitude and Y = longitude. The optional boolean arguments to force the behavior seems not to work. I am reading the polygons from WKB, so swap latitude and longitude is not feasible. Is there any way to bypass this odd behavior?

--
You received this message because you are subscribed to the Google Groups "GeoSpark Discussion Board" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geospark-discussio...@googlegroups.com.
To post to this group, send email to geospark-dis...@googlegroups.com.
Visit this group at https://groups.google.com/group/geospark-discussion-board.
To view this discussion on the web visit https://groups.google.com/d/msgid/geospark-discussion-board/0a48ed9a-42a9-4aaa-a666-e9df73df6bde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

marcelo...@ifood.com.br

unread,
Jun 28, 2018, 6:04:41 PM6/28/18
to GeoSpark Discussion Board
Hello, Jia!

I have already tried it, it is not working for me. Tried all combinations for the boolean arguments described in the docs, and I am still getting the same error. Any other ideas?

Thanks in advance,

Marcelo


Em quinta-feira, 28 de junho de 2018 18:51:23 UTC-3, Jia Yu escreveu:
Hi Marcelo,


It is easy to bypass this.

Thanks,
Jia

------------------------------------

Jia Yu,

Ph.D. Student in Computer Science



On Thu, Jun 28, 2018 at 2:49 PM marcelo.rabello via GeoSpark Discussion Board <geospark-dis...@googlegroups.com> wrote:

I recently noticed that `ST_Transform` is throwing errors on latitude too close to the pole. For some reason, this is happening due to a confusing behavior concerning latitude and longitude order. In theory `ST_Transforms` expects X = longitude and Y = latitude, as stated here, but the in practice it is considering X = latitude and Y = longitude. The optional boolean arguments to force the behavior seems not to work. I am reading the polygons from WKB, so swap latitude and longitude is not feasible. Is there any way to bypass this odd behavior?

--
You received this message because you are subscribed to the Google Groups "GeoSpark Discussion Board" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geospark-discussion-board+unsub...@googlegroups.com.

Jia Yu

unread,
Jun 28, 2018, 6:30:44 PM6/28/18
to marcelo...@ifood.com.br, GeoSpark Discussion Board
Hi Marcelo,

If none of the following work for you, this means probably there are some out-of-range or dirty data in your original data file. The ST_Transform is a distributed SQL wrapper for GeoTools. The error is sent by GeoTools. You can try to find some solutions under "geotools" keywords.

SELECT ST_Transform(polygondf.countyshape, 'epsg:4326','epsg:3857',true, false)

SELECT ST_Transform(polygondf.countyshape, 'epsg:4326','epsg:3857',false, false)

------------------------------------

Jia Yu,

Ph.D. Student in Computer Science


On Thu, Jun 28, 2018 at 3:04 PM marcelo.rabello via GeoSpark Discussion Board <geospark-dis...@googlegroups.com> wrote:
Hello, Jia!

I have already tried it, it is not working for me. Tried all combinations for the boolean arguments described in the docs, and I am still getting the same error. Any other ideas?

Thanks in advance,

Marcelo

Em quinta-feira, 28 de junho de 2018 18:51:23 UTC-3, Jia Yu escreveu:
Hi Marcelo,


It is easy to bypass this.

Thanks,
Jia

------------------------------------

Jia Yu,

Ph.D. Student in Computer Science



On Thu, Jun 28, 2018 at 2:49 PM marcelo.rabello via GeoSpark Discussion Board <geospark-dis...@googlegroups.com> wrote:

I recently noticed that `ST_Transform` is throwing errors on latitude too close to the pole. For some reason, this is happening due to a confusing behavior concerning latitude and longitude order. In theory `ST_Transforms` expects X = longitude and Y = latitude, as stated here, but the in practice it is considering X = latitude and Y = longitude. The optional boolean arguments to force the behavior seems not to work. I am reading the polygons from WKB, so swap latitude and longitude is not feasible. Is there any way to bypass this odd behavior?

--
You received this message because you are subscribed to the Google Groups "GeoSpark Discussion Board" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geospark-discussio...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GeoSpark Discussion Board" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geospark-discussio...@googlegroups.com.

To post to this group, send email to geospark-dis...@googlegroups.com.
Visit this group at https://groups.google.com/group/geospark-discussion-board.
Reply all
Reply to author
Forward
0 new messages