update xy field

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

update xy field

Ed Eads

All,

 

I have xy data in a PostgreSQL table and was able to add a geom column.

The issue showed up when I then attempted to update the geom column with the xy values.

I want to transform from xy values to a gis-enabled table. Any assistance is appreciated. Thanks - Ed

 

ALTER TABLE "APDinternal"."Incidents"

ADD COLUMN geom geometry(POINT,2264);

UPDATE "APDinternal"."Incidents" SET geom = ST_SetSRID(ST_MakePoint(Xinc,Yinc),2264);

 


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: update xy field

Peter N. Schweitzer
I don't know whether this is the only way to do it, but I would do

select AddGeometryColumn ('APDinternal','Incidents','geom',2264,'POINT',2);

then do your update command--I think that part is correct.

Peter


On Mon, Apr 10, 2017 at 12:54 PM, Ed Eads <[hidden email]> wrote:

> All,
>
>
>
> I have xy data in a PostgreSQL table and was able to add a geom column.
>
> The issue showed up when I then attempted to update the geom column with the
> xy values.
>
> I want to transform from xy values to a gis-enabled table. Any assistance is
> appreciated. Thanks - Ed
>
>
>
> ALTER TABLE "APDinternal"."Incidents"
>
> ADD COLUMN geom geometry(POINT,2264);
>
> UPDATE "APDinternal"."Incidents" SET geom =
> ST_SetSRID(ST_MakePoint(Xinc,Yinc),2264);
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users



--
Peter N. Schweitzer (U.S. Geological Survey, Reston, VA 20192)
(703) 648-6533  email: [hidden email]
http://geology.usgs.gov/peter/
https://orcid.org/0000-0002-9532-6681
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: update xy field

Mike Toews-2
In reply to this post by Ed Eads
On 11 April 2017 at 04:54, Ed Eads <[hidden email]> wrote:

> All,
>
> I have xy data in a PostgreSQL table and was able to add a geom column.
>
> The issue showed up when I then attempted to update the geom column with the
> xy values.
>
> I want to transform from xy values to a gis-enabled table. Any assistance is
> appreciated. Thanks - Ed
>
> ALTER TABLE "APDinternal"."Incidents"
>
> ADD COLUMN geom geometry(POINT,2264);
>
> UPDATE "APDinternal"."Incidents" SET geom =
> ST_SetSRID(ST_MakePoint(Xinc,Yinc),2264);

What was the issue? If Xinc and Yinc are already in EPSG:2246, then
these steps look correct. However, if the coordinates need to be
projected, then you need to find out the spatial reference system of
these coordinate columns, and use ST_Transform to project them.

-Mike
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users