Hello @sam.rothstein @Gabby_Getz @cesium community.
I am trying to implement the functionality where if user click on any region on globe, user should get the EPSG code for that particular region.
So is there any API in cesium.js to get EPSG code for the particular cartesian or cartographic point ?
If API’s are not available then how can I get the EPSG code from clicked position in cesium?
Thanks you !!
Looking forward for answers.
Maybe, there is a slight misunderstanding what EPSG-codes are.
EPSG codes define the coordinate system (of your data) and therefore don’t change for every point. The mentioned cartesian coordinates have the coordinate system EPSG:4978 (all of them) and the cartographic coordinates have EPSG:4979.
Or do you want to give info about an other appropriate coordinate system for the area around the point (e.g. UTM zone 32N for all points in central europe)?
Thanks you for your reply,
from what I have understood from EPSG code is, These are specific codes for region. So if I have longitude, latitude information of say a one of the location from that region then I should be able to find the EPSG code for that region.
Let me know if I am wrong.
As Lennart said, EPSG codes define a coordinate system. If you know the EPSG code of a set of input coordinates, there are tools such PROJ which will transform those coordinates into the coordinate system of another EPSG code.
However, I don’t believe its possible to determine the EPSG from one particular cartesian or cartographic point. Additionally, CesiumJS is a runtime engine, so it generally deals with data which has already been transformed into specific coordinate systems. Other tools specialize in projecting data to other coordinate systems or similar geospatial operations.
If you’re talking specifically about a
Cartesian in CesiumJS, it will always be EPSG:4978. If its a
Catographic in CesiumJS, it will always be EPSG:4979.
Well, it’s complicated. Like the others have said, it’s about coordinate systems. However, there are parts of this story that do have a geographic component, from more localized coordinate systems to projected coordinate systems with a translation from some coordinate into one that is anchored in a different location (projected coordinate systems are typically a grid definition from a defined point on the earth that is within reasonable distance from the grid itself). Some of these are for historical reasons, some are practical, and it also can get a bit tricky where a “coordinate system” is not just the definition of coordinate parameters (ie. X, Y, Z) but how those translate to a global surface (so, for example, the ellipse that represent the globe of the earth is defined differently in different coordinate systems).
The second part to this then become geoids, which are definitions (in grid form, for the most part) of gravity influences on the “water level” (but not terrain; that’s an added hot potato on top) of the given ellipsis. Often a coordinate system and geoids go hand in hand, but for a variety of reasons (systems, hardware, time, history, practicalities, etc.) they sometimes even mix those. Madness.
So, back to the original question; in a general sense, EPSG codes are just a definition of a coordinate system. But you can say that some are more local than others. Some are global, like WGS84 (EPSG 4326), others very local (EPSG 6628 is Zone 1 in Hawaii), and anything in-between. In some sense, you can pick a point on the globe, and find out what coordinate systems are the most local or most applicable, and so on, but that doesn’t mean they are “the coordinate system for that location” or that it’s better or more suited or anything like that. These are more preferences of what data you’ve got and what you want to do with it.
In the end, though, this is not a Cesium question, but a geospatial question, so you can maybe get better help on these things over here; https://gis.stackexchange.com/