<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:st1 =
"urn:schemas-microsoft-com:office:smarttags"><HEAD><TITLE>populating a table</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
w\:* {
BEHAVIOR: url(#default#VML)
}
..shape {
BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]--><o:SmartTagType name="City"
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType
name="place"
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType
name="PersonName"
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><!--[if !mso]>
<STYLE>st1\:* {
BEHAVIOR: url(#default#ieooui)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
font-family: Tahoma;
}
@page Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: #606420; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: #606420; TEXT-DECORATION: underline
}
P {
FONT-SIZE: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: "Times New Roman"; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto
}
SPAN.EmailStyle18 {
COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=#606420 link=blue>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT face=Arial
color=#0000ff size=2>Depends on what OS you are running? But generally you
load the postgis functions separately and you have to make sure you have plpgsql
enabled in your database.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT face=Arial
color=#0000ff size=2>If you have the .so files (on unix) or the .dll files
on windows then you just have to load the functions in your db
with</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT
face="Courier New">createlang plpgsql yourtestdatabase <BR>psql -d
yourtestdatabase -f lwpostgis.sql <BR>psql -d yourtestdatabase -f
spatial_ref_sys.sql </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT
face="Courier New"></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT
face="Courier New">If you don't have the functions then its a bit more
involved. The lwpostgis.sql and spatial_ref_sys.sql in a
postgresql install prepackaged with postgis are usually located in the
share\contrib and share\contrib\postgis folders.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT
face="Courier New"></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT
face="Courier New"></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=176464412-12032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Malm
Paul<BR><B>Sent:</B> Monday, March 12, 2007 8:42 AM<BR><B>To:</B> PostGIS Users
Discussion<BR><B>Subject:</B> RE: [postgis-users] populating a
table<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Yes it is a new
database, I can also see that the </SPAN></FONT><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">AddGeometryColumn has a green
underscore<FONT color=navy><SPAN style="COLOR: navy"> in the SQL window in
pgadmin: </SPAN></FONT>SELECT
<U>AddGeometryColumn</U>('public','h1707640_cul_transl','the_geom','-1','MULTILINESTRING',2);<o:p></o:p></SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I
have not seen any error messages when I created the database but I’ve not
explicit loaded any functions as AddGeometryColumn. Do you know how I do
this or where to read about it?<o:p></o:p></SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks!<o:p></o:p></SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Paul</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<DIV>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT
face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B><SPAN
style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Obe, Regina<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> den 12 mars 2007 13:22<BR><B><SPAN
style="FONT-WEIGHT: bold">To:</SPAN></B> PostGIS Users Discussion<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [postgis-users] populating a
table</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Is this a new database
you are loading into? Sounds like you are missing the addgeometrycolumn
function perhaps because load of postgis functions failed when creating the
database or you didn't load them.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Other possibility is
that you have the addgeometrycolumn function, but it is not in your default
schema or one of your search schemas.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT
face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt"><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B><SPAN
style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B><st1:PersonName w:st="on">Malm
Paul</st1:PersonName><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B>
Monday, March 12, 2007 8:13 AM<BR><B><SPAN
style="FONT-WEIGHT: bold">To:</SPAN></B>
postgis-users@postgis.refractions.net<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> [postgis-users] populating a
table</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><!-- Converted from text/rtf format -->Hi!</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">This has worked before, could anyone
please tell me what’s wrong?</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I’m
trying to create and populate a Table in my database with a script</SPAN></FONT>
<FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">generated with</SPAN></FONT> <FONT
face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">shp2pgsql.exe
SQL:</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">BEGIN;</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">CREATE TABLE
"public"."h1707640_cul_transl" (gid serial PRIMARY
KEY,</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN lang=SV
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"f_code"
varchar(5),</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN lang=SV
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"f_code_des"
varchar(254),</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"exs"
int2,</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"exs_descri"
varchar(254),</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"tile_id"
int2,</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"edg_id"
int4,</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"shape_leng"
numeric);</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">SELECT
AddGeometryColumn('public','h1707640_cul_transl','the_geom','-1','MULTILINESTRING',2);</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">INSERT INTO
"public"."h1707640_cul_transl"
("f_code","f_code_des","exs","exs_descri","tile_id","edg_id","shape_leng",the_geom)
VALUES
('AP030','Road','28','Operational','1','6','3.05816496139e004','01050000000100000001020000000300000084F6FF3F5A8152C0580100E0D26144402C2000C05C8152C02A2E00C0D361444007EDFF1F5F8152C055210060D2614440');</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">END;</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I’m
getting the following error message:</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">NOTICE: CREATE TABLE will
create implicit sequence "h1707640_cul_transl_gid_seq" for serial column
"h1707640_cul_transl.gid"</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">NOTICE: CREATE TABLE / PRIMARY
KEY will create implicit index "h1707640_cul_transl_pkey" for table
"h1707640_cul_transl"</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">ERROR: function
addgeometrycolumn("unknown", "unknown", "unknown", "unknown", "unknown",
integer) does not exist</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">SQL
state: 42883</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hint: No function matches the given
name and argument types. You may need to add explicit type
casts.</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Character:
225</SPAN></FONT><o:p></o:p></P>
<P><A name=""></A><B><FONT face=Arial size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">Paul
Malm</SPAN></FONT></B><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Saab Systems, Naval Systems
Division</SPAN></FONT><o:p></o:p></P>
<P><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Tel: +46 8 580 838
22</SPAN></FONT><o:p></o:p></P>
<P><st1:City w:st="on"><st1:place w:st="on"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Mobile</SPAN></FONT></st1:place></st1:City><FONT
face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">: +46 734
373 822</SPAN></FONT><o:p></o:p></P></DIV>
<P>
<HR SIZE=1>
<P></P><BR>
<P><STRONG><BR>The substance of this message, including any attachments, may
be<BR>confidential, legally privileged and/or exempt from disclosure<BR>pursuant
to Massachusetts law. It is intended solely for the<BR>addressee. If you
received this in error, please contact the sender<BR>and delete the material
from any computer.<BR></STRONG></P></BODY></HTML>