[jira] [Commented] (JENA-2266) convertLatLon swaps coordinates

2022-01-31 Thread Greg Albiston (Jira)


[ 
https://issues.apache.org/jira/browse/JENA-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17484988#comment-17484988
 ] 

Greg Albiston commented on JENA-2266:
-

Sorry, but I'm unclear about your use case and how it relates to GeoSPARQL Jena.

Perhaps this question may be better directed at the {{us...@jena.apache.org}} 
mailing list with further detail provided.

> convertLatLon swaps coordinates
> ---
>
> Key: JENA-2266
> URL: https://issues.apache.org/jira/browse/JENA-2266
> Project: Apache Jena
>  Issue Type: Bug
>  Components: GeoSPARQL
>Affects Versions: Jena 4.3.2
>Reporter: Claus Stadler
>Priority: Major
> Attachments: image-2022-01-30-18-28-56-974.png
>
>
> The correct setting is that longitude corresponds to x-axis and latitude to 
> y-axis, but in the code lat is passed for x and lon for y.
> {code:java}
> public class ConvertLatLon {
> public static final Literal toLiteral(double lat, double lon) {
> checkBounds(lat, lon);
> return WKTLiteralFactory.createPoint(lat, lon, SRS_URI.WGS84_CRS);
> }
> }
> {code}
> {code:java}
> public class WKTLiteralFactory {
> public static final Literal createPoint(Double x, Double y, String 
> srsURI) {
> String tidyURI = tidySrsURI(srsURI);
> return ResourceFactory.createTypedLiteral(tidyURI + "POINT(" + 
> reducePrecision(x) + " " + reducePrecision(y)
>  + ")", WKTDatatype.INSTANCE);
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (JENA-2266) convertLatLon swaps coordinates

2022-01-30 Thread Claus Stadler (Jira)


[ 
https://issues.apache.org/jira/browse/JENA-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17484490#comment-17484490
 ] 

Claus Stadler commented on JENA-2266:
-

Hm I see.

So the safest approach to ending up with a JTS Geometry which works 
out-of-the-box with e.g. leaflet via JTS' GeoJsonWriter or WktWriter is to to 
force the SRS using 
geometryWrapper.convert(SRS_URI.DEFAULT_WKT_CRS84).getParsingGeometry. At this 
stage getXYGeometry should be the same - right? - Or is one of the geometry 
getters preferred over the other?

It seems this issue can be closed as "not a bug".


> convertLatLon swaps coordinates
> ---
>
> Key: JENA-2266
> URL: https://issues.apache.org/jira/browse/JENA-2266
> Project: Apache Jena
>  Issue Type: Bug
>  Components: GeoSPARQL
>Affects Versions: Jena 4.3.2
>Reporter: Claus Stadler
>Priority: Major
> Attachments: image-2022-01-30-18-28-56-974.png
>
>
> The correct setting is that longitude corresponds to x-axis and latitude to 
> y-axis, but in the code lat is passed for x and lon for y.
> {code:java}
> public class ConvertLatLon {
> public static final Literal toLiteral(double lat, double lon) {
> checkBounds(lat, lon);
> return WKTLiteralFactory.createPoint(lat, lon, SRS_URI.WGS84_CRS);
> }
> }
> {code}
> {code:java}
> public class WKTLiteralFactory {
> public static final Literal createPoint(Double x, Double y, String 
> srsURI) {
> String tidyURI = tidySrsURI(srsURI);
> return ResourceFactory.createTypedLiteral(tidyURI + "POINT(" + 
> reducePrecision(x) + " " + reducePrecision(y)
>  + ")", WKTDatatype.INSTANCE);
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (JENA-2266) convertLatLon swaps coordinates

2022-01-30 Thread Greg Albiston (Jira)


[ 
https://issues.apache.org/jira/browse/JENA-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17484418#comment-17484418
 ] 

Greg Albiston commented on JENA-2266:
-

Longitude is indeed the X axis and latitude is the Y axis. However, the SRS 
EPSG 4326 (referenced by {{{}SRS_URI.WGS84_CRS{}}}) used for WGS84 reverses the 
axis order when encoding to latitude/longitude. The SRS OGC CRS84 has the axis 
order longitude/latitude.

The produced Point literal conforms with the axis order, if it is perhaps 
somewhat confusing in the naming of function parameters.

An example of this is provided on page 17 of the GeoSPARQL standard.

!image-2022-01-30-18-28-56-974.png!

> convertLatLon swaps coordinates
> ---
>
> Key: JENA-2266
> URL: https://issues.apache.org/jira/browse/JENA-2266
> Project: Apache Jena
>  Issue Type: Bug
>  Components: GeoSPARQL
>Affects Versions: Jena 4.3.2
>Reporter: Claus Stadler
>Priority: Major
> Attachments: image-2022-01-30-18-28-56-974.png
>
>
> The correct setting is that longitude corresponds to x-axis and latitude to 
> y-axis, but in the code lat is passed for x and lon for y.
> {code:java}
> public class ConvertLatLon {
> public static final Literal toLiteral(double lat, double lon) {
> checkBounds(lat, lon);
> return WKTLiteralFactory.createPoint(lat, lon, SRS_URI.WGS84_CRS);
> }
> }
> {code}
> {code:java}
> public class WKTLiteralFactory {
> public static final Literal createPoint(Double x, Double y, String 
> srsURI) {
> String tidyURI = tidySrsURI(srsURI);
> return ResourceFactory.createTypedLiteral(tidyURI + "POINT(" + 
> reducePrecision(x) + " " + reducePrecision(y)
>  + ")", WKTDatatype.INSTANCE);
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)