[postgis-users] transform to postgis

Ethan Alpert ealpert at digitalglobe.com
Mon Oct 4 14:10:23 PDT 2004


Are you able to use perl? It would be very easy to write a perl script
that uses DBI to parse your file and insert records.

-e

Something like:

use DBI;

$dbh =
DBI->connect("DBI:Pg:dbname=<dbname>;host=<host>","<user>","<pwd>")
                        or die "Could not connect to db\n";
$dbh->do("create table mytable (station int, the_geom geometry)");
$dbh->do("CREATE INDEX mytable_oid ON mytable (oid)");
$dbh->do("CREATE INDEX mytable_spatial ON mytable USING GIST ( the_geom
GIST_GEOMETRY_OPS)";

while(<>) {
	chomp;
	($id,$east,$north) = split /\s+/;
	$dbh->do("insert into mytable (station,the_geom) value
($id,GeometryFromText('POINT($east $north)',<srid>))");
}


You'll need to know the spatial reference id (srid) of your date.

-e
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
pinktomate
Sent: Monday, October 04, 2004 2:36 PM
To: PostGIS Users Discussion
Subject: [postgis-users] transform to postgis


if I have a table with coordinates gauss

for example

station         easting         norting
1               1000000         1000000 
2               2000000         2000000
3               3000000         4000000
4               4000000         5000000


in text tabulated, how to transform this table in a shapefile with
spatial component, (spatial points) to introduce it in postgis

is very important for me, 

I want to do the same operation in arcview add event theme, but in
linux, without arcview, 

regards and please help me
        

_______________________________________________
postgis-users mailing list postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list