Re: [postgis-users] Difficulty importing example file nyc_buildings.sql
Thanks to Ben Madin for advice. I removed the apostrophes from the SRID in nyc_buildings.sql (using TextEdit) and re-ran the command /usr/local/pgsql-9.0/bin/psql -f /Users/bacmac/nyc_buildings.sql nyc Unfortunately it produced the same result: BEGIN psql:/Users/bacmac/nyc_buildings.sql:3: NOTICE: CREATE TABLE will create implicit sequence nyc_buildings_gid_seq for serial column nyc_buildings.gid psql:/Users/bacmac/nyc_buildings.sql:3: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index nyc_buildings_pkey for table nyc_buildings CREATE TABLE psql:/Users/bacmac/nyc_buildings.sql:4: ERROR: function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer) does not exist LINE 1: SELECT AddGeometryColumn('','nyc_buildings','the_geom',2908,... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. psql:/Users/bacmac/nyc_buildings.sql:5: ERROR: current transaction is aborted, commands ignored until end of transaction block psql:/Users/bacmac/nyc_buildings.sql:6: ERROR: current transaction is aborted … and so on. I wonder if I need to adjust $PATH so that the function AddGeometryColumn is found? Even when I change directory to /usr/local/pgsql-9.0/bin my Mac cannot find psql if I type that command on its own. I always have to use the full pathname /usr/local/pgsql-9.0/bin/psql. Strange, because typing 'ls' after changing the directory brings up the complete list of files including psql. Bruce Callander ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Difficulty importing example file nyc_buildings.sql
I am following the Geoserver Getting Started documentation in order to create an example PostGIS table. I am working on a MacBook running Snow Leopard v10.6.8 Thanks to previous advice from the forum (Nicolas Ribot) I was able to create the sample database 'nyc' based on the template 'template_postgis'. I am now encountering errors in trying to move to the next stage of importing the file 'nyc_buildings.sql' into the database. The Unix command I am using is: $ /usr/local/pgsql-9.0/bin/psql -f /Users/bacmac/nyc_buildings.sql nyc The Geoserver instructions are not explicit about where to put the nyc_buildings.sql file so I have left it in my own user directory 'bacmac'. Execution of the command produces a string of errors beginning with: CREATE TABLE psql:/Users/bacmac/nyc_buildings.sql:4: ERROR: function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist LINE 1: SELECT AddGeometryColumn('','nyc_buildings','the_geom','2908... HINT: No function matches the given name and argument types. You might need to add explicit type casts. psql:/Users/bacmac/nyc_buildings.sql:5: ERROR: current transaction is aborted, commands ignored until end of transaction block psql:/Users/bacmac/nyc_buildings.sql:6: ERROR: current transaction is aborted ... and so on. I realise that part of my difficulties stem from a lack of conceptual awareness of how the various parts of PostGIS fit together (databases, data stores, tables, clusters...) and what directory structure the PostGIS installation creates. I am very familiar with Access databases but that may be dangerous because the basic paradigm for PostGIS may be different. Are there any diagrams out there that give a basic conceptual view of Geoserver and PostIGIS? Also, I am coming at this from an enterprise SDI policy and implementation end, not from an IT/Unix background (probably very obvious!). Trying to construct a coherent overall picture based on the predominantly text-based, IT-heavy advice online is proving a challenge. Many thanks Bruce Callander ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Difficulty importing example file nyc_buildings.sql
Hi Bruce, I'm pretty new to GIS and PostGIS, but I'll try to offer an idea. It appears that you might not have the postgis code loaded. I'm going to guess that Nicholas' suggestion involved setting up the template_postgis database so that you might make postgis enabled databases without manually importing the postgis.sql and the spatial_ref_sys.sql? Are you confident that you did this properly? The error you're getting makes me thing that the postgis stored procedures are not properly loaded. If you log into the DB using psql and execute \df+ AddGeometryColumn Do you get an emptry result? If this is not the case you might try the same on your template database. Good luck, Andy On 8/15/11 6:28 AM, b...@brucecallander.com wrote: I am following the Geoserver Getting Started documentation in order to create an example PostGIS table. I am working on a MacBook running Snow Leopard v10.6.8 Thanks to previous advice from the forum (Nicolas Ribot) I was able to create the sample database 'nyc' based on the template 'template_postgis'. I am now encountering errors in trying to move to the next stage of importing the file 'nyc_buildings.sql' into the database. The Unix command I am using is: $ /usr/local/pgsql-9.0/bin/psql -f /Users/bacmac/nyc_buildings.sql nyc The Geoserver instructions are not explicit about where to put the nyc_buildings.sql file so I have left it in my own user directory 'bacmac'. Execution of the command produces a string of errors beginning with: CREATE TABLE psql:/Users/bacmac/nyc_buildings.sql:4: ERROR: function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist LINE 1: SELECT AddGeometryColumn('','nyc_buildings','the_geom','2908... HINT: No function matches the given name and argument types. You might need to add explicit type casts. psql:/Users/bacmac/nyc_buildings.sql:5: ERROR: current transaction is aborted, commands ignored until end of transaction block psql:/Users/bacmac/nyc_buildings.sql:6: ERROR: current transaction is aborted ... and so on. I realise that part of my difficulties stem from a lack of conceptual awareness of how the various parts of PostGIS fit together (databases, data stores, tables, clusters...) and what directory structure the PostGIS installation creates. I am very familiar with Access databases but that may be dangerous because the basic paradigm for PostGIS may be different. Are there any diagrams out there that give a basic conceptual view of Geoserver and PostIGIS? Also, I am coming at this from an enterprise SDI policy and implementation end, not from an IT/Unix background (probably very obvious!). Trying to construct a coherent overall picture based on the predominantly text-based, IT-heavy advice online is proving a challenge. Many thanks Bruce Callander ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users -- xforty technologies Andrew Libby http://xforty.com 484-887-7505 x 1115 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Difficulty importing example file nyc_buildings.sql
Bruce, On 15/08/2011, at 6:28 PM, b...@brucecallander.com wrote: $ /usr/local/pgsql-9.0/bin/psql -f /Users/bacmac/nyc_buildings.sql nyc The Geoserver instructions are not explicit about where to put the nyc_buildings.sql file so I have left it in my own user directory 'bacmac'. It doesn't matter, as long as the -f part of the command describes it as you have. You may find it convenient to keep all these scripts together in a single directory somewhere while you are starting. Execution of the command produces a string of errors beginning with: CREATE TABLE psql:/Users/bacmac/nyc_buildings.sql:4: ERROR: function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist LINE 1: SELECT AddGeometryColumn('','nyc_buildings','the_geom','2908... HINT: No function matches the given name and argument types. You might need to add explicit type casts. psql:/Users/bacmac/nyc_buildings.sql:5: ERROR: current transaction is aborted, commands ignored until end of transaction block psql:/Users/bacmac/nyc_buildings.sql:6: ERROR: current transaction is aborted ... and so on. I realise that part of my difficulties stem from a lack of conceptual awareness of how the various parts of PostGIS fit together (databases, data stores, tables, clusters...) and what directory structure the PostGIS installation creates. I am very familiar with Access databases but that may be dangerous because the basic paradigm for PostGIS may be different. Are there any diagrams out there that give a basic conceptual view of Geoserver and PostIGIS? Also, I am coming at this from an enterprise SDI policy and implementation end, not from an IT/Unix background (probably very obvious!). Trying to construct a coherent overall picture based on the predominantly text-based, IT-heavy advice online is proving a challenge. One of the neat / good / bad / helpful / troublesome things that you can do in postgres is define two functions with the same name, as long as they have different parameters and or parameter types. In this case, the import script is loading your sql, but has inappropriately enclosed the srid in quotes '2908' the function you want is: text AddGeometryColumn(varchar schema_name, varchar table_name, varchar column_name, integer srid, varchar type, integer dimension); which specify that the srid should be integer. Because your call starts like : SELECT AddGeometryColumn('','nyc_buildings','the_geom','2908... it won't match one of the above calls (unknown can go into varchar columns, but not into integer columns, which must be integer.) The quickest fix might be to edit the nyc.sql file and remove the quotes from around the srid part of the addgeometrycolumn call. cheers Ben ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users