Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.


I need to determine the distance between a location specified by GPS coordinates and a polygon defined by multiple GPS coordinates. According to the documentation and other posts on this forum, this can be done by converting the data from SRID 4326 (used by GPS systems) to a local plannar SRID and then use the ST_Distance method. Since my data is in Canada, I found 2 SRID that I should be able to use : 3347 and 3348.

My problem is I can't figure out how to transform the data from SRID 4326 to SRID 3347 or 3348. I am using the following code : select new ST_Point(45.566964, -73.753816).ST_SRID(4326).ST_Transform(3347);

I tried with many coordinates around Canada and I get either one of the following errors using Interactive SQL version 16.0.0, build 1948 : --Error 1: Value 59830836.670898 out of range for coordinate x (SRS bounds [2365553.332100, 6624202.315400] exceeded by more than 50%) SQLCODE=-1484, ODBC 3 State="HY000" --Error 2: Failed to transform point (55.307676,-115.330497) (error -14) SQLCODE=-1532, ODBC 3 State="HY000"

Also, I configured my database to use the SRID 3347 and 3348 using the "Create Spacial Reference System Wizard".

Is there something I am missing or is this a problem in SQL Anywhere?


asked 16 Jul '15, 17:35

louisjoelhc's gravatar image

accept rate: 0%

Try reversing your longitude/latitude. SRID 4326 expects coordinates in longitude, latitude order, but you are giving latitude, longitude.

select new ST_Point( -73.753816, 45.566964, 4326 ).ST_Transform(3347)

Point (7615498.02129 1247511.99533)

permanent link

answered 18 Jul '15, 09:47

Phil%20Mitchell's gravatar image

Phil Mitchell
accept rate: 27%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 16 Jul '15, 17:35

question was seen: 3,140 times

last updated: 18 Jul '15, 09:47