2

Via PostGIS I import a shapefile layer with polygons of EU countries. I try select all rows and after still display blue straight line without the end. Where is the problem?

1
  • Hello. Do you have a screenshot by any chance? Commented May 11, 2022 at 12:21

1 Answer 1

1

You probably need to change -- by using ST_Transform() -- the coordinate reference system (CRS) of your geometries, e.g. by using such query instead of a standard SELECT:


SELECT 
  ST_Transform(geom, 4326) AS geom_wgs84, -- adapt "geom" to fit the name of your geometry field if necessary 
  *
FROM mytable
-- WHERE ...;

if it's 3D geometry, they won't be rendered as well, so you need to use ST_Force2D():

SELECT
  ST_Transform(geom, 4326) AS geom_wgs84,
  ST_Force2D(ST_Transform(geom, 4326)) AS geom_2d_wgs84,
  *
FROM mytable
-- WHERE ...;

All this because of that:

When users click a feature in the map, a small pop-up will show up with its property table. If the SRID is 4326 (WGS84) the viewer will transform the coordinates to Web Mercator and add background tile layer.

Source: https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLII-4-W14/79/2019/isprs-archives-XLII-4-W14-79-2019.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.