1

I'm working with SQL Server on a GIS system, and I have a table that has for each row a polygon which delimits an area. I need to read theses values and put them on my map that I'm building with OpenLayers. But I'm having serious problems reading the values. OpenLayers seems not be able to read EPSG:29193 and convert to EPSG:3857.

Is there something that I could do?

Before anything else, I CAN NOT use ArcGIS, GeoServer, or whatever, I HAVE to use only SQL Server to read these polygons (which are stored as array of bytes) and OpenLayers only because the client has serious limitations.

If I use ToString() on the column name it return something like this

POLYGON ((611529.71889999975 7812359.7381, 611515.02589999977 7812357.5313, 611518.44199999981 7812328.4877, 611542.00299999956 7812331.4384, 611529.71889999975 7812359.7381))

But none of these values take me to somewhere that make sense.

I used this point 611529.71889999975 7812359.7381 at the website epsg.io with the described projection (EPSG:29193) and it shows the correct place, but when I try to do the same with openlayers does not works.

asked Feb 1, 2018 at 12:40
7
  • 1
    Those are serious limitations, because Microsoft doesn't have a transform function. Commented Feb 1, 2018 at 12:49
  • That is why I can not convert these values? I don't know what to do with it. Commented Feb 1, 2018 at 12:52
  • Your rule of not using GIS software to reproject the data precudes any possible answer. Commented Feb 1, 2018 at 13:02
  • Unfortunately I must use this to make this work. Now I've could see something using these coords, but it shows a place that is not correct. Commented Feb 1, 2018 at 13:15
  • Is there any projection conversion algorithm I could implement? Because at this point, I think I have not many options to solve this problem. Commented Feb 1, 2018 at 13:20

1 Answer 1

2

Using the SpatialTools you can reproject data

Example:

-- Project point and linestring using Albers Equal Area projection
declare @albers Projection
set @albers = Projection::AlbersEqualArea(0, 0, 0, 60)
select @albers.Project('POINT (45 30)').ToString()
select @albers.Unproject(@albers.Project('LINESTRING (10 0, 10 10)')).ToString()
select @albers.ToString()

https://github.com/Microsoft/SQLServerSpatialTools/blob/master/SQL%20Scripts/projection_example.sql

answered Feb 1, 2018 at 14:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.