<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have one spatial table (my_postgis_table) with a
schema like</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> the_geom,object_name,object_id
......</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'd like to know if is possible in a simple way to
load data from a generic shape file into "my_postgis_table".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The shp2pgsql load data into postgis spatial table
creating a table with the same schema of the shape, so, the problem here is to
"create a mapping" from shp file fields and my table.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The most simple way that I found is the
following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1) use the shp2pgsql loader in order to load the
data into postgres spatial table (my_spatial_table_temp)</FONT></DIV>
<DIV><FONT face=Arial size=2>2) read the schema of "my_spatial_table_temp" and
give to the user a page where to create the mapping between the 2
tables</FONT></DIV>
<DIV><FONT face=Arial size=2>
Example:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>
my_spatial_table_temp.generic_field1 -->
my_postgis_table.object_name</FONT></DIV>
<DIV><FONT face=Arial
size=2>
my_spatial_table_temp.generic_field2 -->
my_postgis_table.object_name</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
and obviously:</FONT></DIV>
<DIV><FONT face=Arial
size=2>
my_spatial_table_temp.geom --> my_postgis_table.the geom</FONT></DIV>
<DIV><FONT face=Arial size=2>
....</FONT></DIV>
<DIV><FONT face=Arial size=2>
and so on ...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>3) Excute the query that copies the gis data from
my_spatial_table_temp to my_postgis_table using the mapping just
created.</FONT></DIV>
<DIV><FONT face=Arial size=2>4) drop the "my_spatial_table_temp"
table</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>is this the right way or exists another procedure
more simple than this one?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advance.</FONT></DIV>
<DIV><FONT face=Arial size=2>RedS</FONT></DIV></FONT></DIV></BODY></HTML>