The construction of geography data is too complex in the source code

eg. ST_GeogfromText(wkt string) constructs a struct Geography as below:
wkt->geom->wkb->geom->wkb->spatialObject->geography.

Hi @jievince! Could you say a bit more about what you’re trying to do? I can’t tell if you’re having a problem on your end, or if you are pointing out a possible performance enhancement.

It would be helpful if you could provide a link to the code you are talking about.

BTW, I don’t have any performance issues with usage, I just I’m just curious about the source code implementation of geo spatial.

I’m reading the geo spatial source code of cockroachdb, and feel confused about on the construction of Geography.
See the functions ParseGeographyFromEWKT, ParseGeographyFromEWKB:

good catch! this was a relic of us doing something different before we had a native go WKT parser.

geo: simplify WKT conversion by otan · Pull Request #70096 · cockroachdb/cockroach · GitHub fixes that up.