Subscribe to this thread
Home - General / All posts - projection M8 RS9 ( user geomatic)
lionel

457 post(s)
#25-Dec-17 20:26

http://www.georeference.org/forum/t137776.12 ( at the end of the post )

in a thread geomatic post a question the 15-Nov-17 00:39

In Manifold 8 I use the following query to generate lat/lon WKT from any projection:

SELECT [Field]

CStr(CGeomWKB(Project(Geom(ID), COORDSYS("Latitude / Longitude")))) AS [POLYGON]

FROM [Drawing]

In Radian Studio / Manifold Future I try to do the same but I don't know how to re-project within the query:

SELECT [Field], GeomWkt([Geom (I)]as [POLYGON]

FROM [Drawing];

Please help!

Thanks in advance.


join image "Because my dad promised me" interstellar from Manifold: Time by Stephen Baxter. power Math destruction

lionel

457 post(s)
#25-Dec-17 20:30

Don' know about projection ( need to study TODO List ) . The query builder in RS9 don'y show item relative to reprojection when use word proj but many with CoordSystem !!!

see http://www.manifold.net/doc/radian/sql_functions.htm

paste inside n command or query editor "" ? CALL CoordSystemTypes() "" or others options are usefull to know /Do .

for manifold

code

SELECT 

CStr(CGeomWKB(Project(Geom(ID), COORDSYS("Latitude / Longitude")))) AS [POLYGON]

FROM [Drawing]

for radian

SQL9

SELECT  GeomWkt([Geom]) as [POLYGON] FROM [Drawing];

Attachments:
proj_coordSystem.png


join image "Because my dad promised me" interstellar from Manifold: Time by Stephen Baxter. power Math destruction

adamw

8,061 post(s)
#26-Dec-17 09:02

Example that uses components from a different thread of yours:

--SQL9

SELECT ID, CoordConvert( -- converting coordinates of geom

  CALL CoordConverterMake( -- conversion is performed by converter

    ComponentCoordSystem(proj_ok), -- to coord system of proj_ok

    ComponentCoordSystem(proj_bad)), -- from coord system of proj_bad

  geom-- the geom being converted

FROM proj_bad;

This produces a table with the ID and the converted geom. If you want WKT, add a call to GeomWkt.

The UI tools that perform coordinate conversion (for example, Change Coordinate System dialog) use similar code, the only significant change is that the creation of the coordinate converter is moved to a separate function, this currently optimizes better.

artlembo

3,077 post(s)
online
#29-May-18 01:11

Adam,

One thing I noticed, following this example is that there is no control over the XY / YX thing. So, this query:

UPDATE

(

SELECT mfd_id,[geom (I)], (CoordConvert(CALL CoordConverterMake(

    CoordSystemEPSG(4326),

 ComponentCoordSystem(parcels)

    ), 

     [geom (i)])) as g 

FROM parcels)

SET [geom (i)] = g

Is going to flip the X and Y coordinates. When working with Lat/Lon, it would seem we need to write out the definition:

CoordConverterMake('EPSG:4326,mfd:{ "Axes": "XY" }'

But, if we choose instead to go from NYS Central (which is the coordinate system of parcels), this works just fine:

UPDATE

(

SELECT mfd_id,[geom (I)], (CoordConvert(CALL CoordConverterMake(

    CoordSystemEPSG(32618),

 ComponentCoordSystem(parcels)

    ), 

     [geom (i)])) as g 

FROM parcels)

SET [geom (i)] = g

Is there a way to deal with the XY thing when calling CoordSystemEPSG(4326)?

tjhb

8,215 post(s)
#29-May-18 02:07

Something isn’t right there Art.

The first conversion, from the CS of [parcels] (NYS Central) to EPSG 4326, must flip coordinates, because 4326 is YX. But that is only a problem if you don’t also change the projection of the drawing after the update—but you should. If the drawing’s projection is changed to match, coordinate order will be shown as stored.

I don’t follow the point about Lat/Lon—which is not EPSG 4326.

However, doesn’t that middle snippet (with the mfd: “{Axes...}” override) answer your last question?

adamw

8,061 post(s)
#29-May-18 09:13

EPSG:32618 uses XY (it is transverse Mercator), that's why the second query outputs XY.

Are you asking if there is any helper function / additional argument to pass to CoordSystemEPSG to force axes to XY there as well? We don't have any special functions / arguments for that (you can do CoordSystemOverride('EPSG:4326', '{ "Axes": "XY" }'), but that still requires to type JSON), but it might be a good idea to add some.

artlembo

3,077 post(s)
online
#29-May-18 13:49

honestly, using CoordSystemOverride('EPSG:4326', '{ "Axes": "XY" }') isn't horrible. In fact, it is only requiring a user to add '{ "Axes": "XY" }' to what you'd normally write with CoordSystemEPSG. The truth of the matter is, if you want to do something really, really, quick, the GUI works just fine. If you want to do it in SQL, then adding the extra JSON clause is fine, especially if you have a cheat sheet lying around where you can copy/paste the information.

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.