question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Geometry column - invalid representation

See original GitHub issue

Bug report

Describe the bug

When creating a geometry data type column, its representation is looking odd. It shows a random capital letter string such as: 0101000020E61000002C64AE0CAA0129409F1CAACE0FF34440

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a table
  2. Add a geometry data type column with: SELECT AddGeometryColumn ('','geometries','geom',4326,'POINT',2);
  3. Insert records to the table with the geometry column as ST_SetSRID(ST_MakePoint(lng, lat), 4326)
  4. See the table editor in order to find the column representation.

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

It shows like this: image

But should show something like: image

System information

  • OS: Windows 10
  • Browser: Chrome

Additional context

Followed this tutorial to get the column as I wanted.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
steve-chavezcommented, Nov 4, 2021

You can use SELECT st_asgeojson(location) FROM tbl to get the representation you want.

https://postgis.net/docs/ST_AsGeoJSON.html

invalid representation

Not really invalid, it’s the geometry type default representation, which has to be converted to other formats to be human-readable.

http://postgis.net/workshops/postgis-intro/geometries.html#geometry-input-and-output

1reaction
soedirgocommented, May 11, 2022

I think it’s as Steve mentioned above, it’s the default presentation for geometry (can be confirmed with select st_point(1,1)::geometry in psql).

Making it more user-friendly from the dashboard side might be a lot of work (e.g. need to parse the format) but as a user I would just add a generated column like so:

alter table geometries add column geom_display text generated always as (st_asgeojson(geom)) stored;
Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR: parse error - invalid geometry (Postgis)
Use the Postgres concat operator to add a leading LINESTRING, so that you have a valid textual representation of a geometry.
Read more >
MySQL Bugs: #80123: Invalid MULTIPOLYGON geometry ...
Description: Trying to add a 'MULTIPOLYGON(((0 0,0 0,0 0,0 0)))' to a geometry column succeeds althought GIS data seems to be invalid since ......
Read more >
Error when trying to alter column type from text to geometry
The error means that the geometry input function expects the string to be in EWKB format, where each byte is represented by two...
Read more >
Data QA: Identifying Invalid Geometry Types - FME Community
Whether such a geometry is truly invalid depends on both the user's interpretation of the data and any special circumstances. For example, the ......
Read more >
Chapter 4. Data Management - PostGIS
In planar reference systems the X and Y coordinates typically represent easting ... PostGIS also allows storing and manipulating invalid geometry values.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found