Tag Info

New answers tagged

1

A better way to explore changing projections is just to work in QGIS. Load both your datasets, and ensure your 'correct' one has the right coordinate system defined. Do this by double clicking on the layer, going to the general tab of the properties, and ensuring the coordinate reference system is set correctly. Now ensure that you have enabled 'on the ...


3

To add a column to an existing table, use the ALTER TABLE DDL, e.g.: ALTER TABLE my_table ADD COLUMN the_geom_mercator geometry(Geometry,3857); which can be populated from another column (the_geom) using: UPDATE my_table SET the_geom_mercator = ST_Transform(the_geom, 3857) FROM spatial_ref_sys WHERE ST_SRID(the_geom) = srid; (the second line FROM ...


1

You can create an unconstrained SRID geometry column to hold the native form and then transform to existing. Here is a contrived example assuming you have polygons that you are copying from a staging table (if you have mixed, you can set type to geometry e.g geometry(Geometry,3857): CREATE TABLE poi(gid serial primary key, geom_native ...


0

If you don't define SRID for the geometry column at the time of its creation, you can insert geometries with any SRID. I can't think of a reason you would want to do that though. It's reasonable to store all geometries with the same SRID. I see three options you have: create new geometry column and fill it with st_transform(geom1, new_srid) use ...


2

Just a little bit more of the Lunar Sea answer. Your query it's ok. The problem is that you didn't gave a nome to the geometry column so qgis don't like it. Specify ::geometry ecc... is important but not essential if you know what is it inside your table. It could be possible that you have to specify Multilinestring instead of Linestring. CREATE VIEW ...


1

EDIT: The geom column needs registering in the view public.geometry_columns. This is done by adding '::geometry(linestring, SRID)' to the query: ST_MakeLine(point1.geom, point2.geom)::geometry(linestring, SRID) Thanks @user30184 for the link to the docs



Top 50 recent answers are included