[postgis-users] Creating points from x and y values

Chris Jewell c.jewell at lancaster.ac.uk
Wed Sep 5 04:11:21 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I have a question concerning creating a Point column from two int columns of x and y
coordinate respectively.  The reason for this is that I receive regular updates of my
data as a CSV file which I can import directly into a flat table, and then normalise it
(which includes setting up a geometry column of points).

What I'd like to do is something like:

INSERT INTO gis_tbl ("id",coords) (SELECT "id", PointFromText('POINT(x_coord
y_coord)',27700) FROM flat_tbl);

There is, of course, the problem that x_coord and y_coord are not recognised as
database objects because of the surrounding quotes.  Does anyone have a workaround, or
do I need to write a Python script to do it (which seems rather inefficient).

Thanks,

Chris
- --
Chris Jewell
Dept of Maths and Statistics
Fylde College
Lancaster University
Lancaster
Lancs
LA1 4YF
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG3o7ZtbYC54ephxMRAkyhAKCv4HbpAXTOtpInk/CtZE6BTfW/2ACeJcRB
BoFouKx8yJUd6Q/97SKLjgE=
=qU9g
-----END PGP SIGNATURE-----



More information about the postgis-users mailing list