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.

7
  • 1
    Those are serious limitations, because Microsoft doesn't have a transform function. – Vince Feb 1 '18 at 12:49
  • That is why I can not convert these values? I don't know what to do with it. – Adenir Souza Feb 1 '18 at 12:52
  • Your rule of not using GIS software to reproject the data precudes any possible answer. – Vince Feb 1 '18 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. – Adenir Souza Feb 1 '18 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. – Adenir Souza Feb 1 '18 at 13:20
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.