2

I have some extravagant local spatial reference system and I have a lot of data stored in some old legacy system. Now I want to import this data to my Postgresql/Postgis database. On the client side I'm using JavaScript OpenLayers 3 library (if it matters), on the server side I'm used to storing geometry data with srid 3857, so my tables with layer data have such constraints:

 CONSTRAINT enforce_dims_geom_layer_1_ CHECK (st_ndims(geom) = 2),
 CONSTRAINT enforce_srid_geom_layer_1_ CHECK (st_srid(geom) = 3857)

So, if I have this legacy data, with some coordinates in a local reference system, how can I approach this problem to get a formula like:

+proj=longlat +ellps=bessel +towgs84=595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408 +no_defs
5
  • When you say "local reference system", is that an actual geodetic coordinate system (i.e. tied to long/lat coordinates with some defined meridian and sphere) or just coordinates tied to a local origin? Can you edit your question to put the information about your local reference system? Commented Jul 4, 2016 at 14:26
  • @Patrick. It is not an actual/standardazied coordinate system. It is some system tied to a local origin. The only thing that I know for sure, is that there is no espg-code for this system, it does not exist in spatial_ref_sys, so I have to create it myself. What I have is just raw data with some attributes, including X and Y coordinates. I cannot put any information about this system, because I know nothing. What ingredients should I know and what questions should I ask about this reference system to be able to answer to your question? Commented Jul 4, 2016 at 16:18
  • Sorry, I said it is not an actual coordinate system. But in fact it is, because it is used in my local area. Although, I do not know much about this system. I do not know even what should I know about it to be able to create a formula like those in spatial_ref_sys table. Commented Jul 4, 2016 at 16:27
  • You absolutely need a few things to make this work. (1) Your local coordinate system has an origin (0, 0) somewhere; you need to know the (long, lat) coordinate of that origin. (2) You need to know the orientation and unit-of-measure or the (long,lat) coordinate of some other point in your local system. (3) You need to know the sphere and datum of your local system. Using that you can create a coordinate system using a good GIS (ArcGIS or QGIS, for instance). If you do not have (3) you can make a guess based on approximate location and age of the data. Commented Jul 4, 2016 at 19:14
  • @Patrick! Great answer! If you can provide some teeny-weeny example (something like - "Imagine with have this data, with these three sample points with these coordinates with this origin, orientation etc., then we will have this formula - +proj=longlat +ellps=..."), it will be really helpful and useful to many people, including me. If you have some time, you may make a complete answer (not just a comment). Thanks again! Commented Jul 4, 2016 at 19:26

2 Answers 2

2

Have a look at the public.spatial_ref_sys table. There the SRIDs are defined and you can insert your new SRID. The column proj4text includes the formulas.

Sign up to request clarification or add additional context in comments.

6 Comments

Well, the catch is I know about this spatial_ref_sys table. My question is not about how to insert to this table some abstract srid, but how to figure out the real formula for some new real srid based on legacy data that I have. So, the whole problem is in formula. How can I get something like +proj=longlat +ellps=bessel ... from my data which is in local spatial reference system?
If you stored your data in SRID 3857 isn't it just SELECT proj4text FROM spatial_ref_sys WHERE srid = 3857? so in this case you will get +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs
No. As I said "I have some extravagant local spatial reference system". So, it is not in SRID 3857. But this is what I want to achive - to be able to convert it to SRID 3857. To do this I should build up some formula, like many of those stored in proj4text column in spatial_ref_sys table. And this is what my question is about.
I see. I also read your comments above and if you have no information about the projection it is hard to create a formula for. In a GIS like QGIS you can define custom CRS and you can see all the parameters (this is what this formula actually is). Can you give more information about the area, coordinates etc.? It is not possible to guess your CRS parameters and your your data is stored in 3857.
Estern Europe, coordinates look like X="55451.81" Y="43782.13". I guess what I need is just a technique for some abstract local reference system. When you have one and when you know that it is not codified, what should you know about this system to be able to create a formula like those in spatial_ref_sys?
|
0

The website https://epsg.io will generate an insert string for your SRID if you can find the page for your desired EPSG code. Once you find the page for the code you want, scroll down to "Export", below that on the left set it to "PostGIS". You can then "Copy TEXT", and paste that into your terminal or whatever you use to interact with your database.

Comments

Your Answer

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.