GPSFileDepot.com
 

News:

Welcome to GPSFileDepot!

Main Menu

Water Data Errors

Started by msbell1, January 17, 2009, 08:16:57 AM

Previous topic - Next topic

msbell1

Hi. I am totally new to this map making stuff, but I just bought a Garmin GPSmap 60CSx and I want to load topographic maps on it, so I've been trying to make my Illinois topo map. I've followed the instructions in the tutorial to the letter, but I'm stating to have problems now with the water data.

I've made it through the steps just fine until I come to the "Processing the PostGIS Data" section. In that section I have downloaded the NHD queries, and I have extracted them to the PostgreSQL bin folder. The next step is where I start to have problems.

Here is what my DOS prompt looks like:
C:\Program Files\PostgreSQL\8.3\bin>psql -d postgis -h localhost -U postgres -f area_sql.txt

When I hit enter I get the following messages:
psql:area_sql.txt:1: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:2: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:3: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:4: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:5: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:6: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:7: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:8: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:9: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:10: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:11: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:12: ERROR: relation "nhd_area" does not exist
psql:area_sql.txt:13: ERROR: relation "nhd_area" does not exist

Does anyone have any idea what's going on? I wish I knew more about this. But I have no idea what I'm even trying to accomplish in this step. I'm just blindly following instructions, so I can't even begin to figure out how to make this work now. Thanks a lot for your help!

Mike

Tsnake

I don't think I can help you with this, but I have just finished an Illinois map and posted it to this site yesterday.  It contains topo, water, roads, federal lands, and state parks.  I am currently processing just topo and water data and will post that map when it completes.

For your problem, try drop table nhd_area.  I have had the problem before where if a table already existed, I couldn't add more to it.  Therefore, this might be an extension of that.  I would try again from scratch.

krellor

"nhd_area" is the name of a table it is expecting to find.  I'm not really very familiar with a lot of these utils because I can't see the code, but is this step you are basically running SQL queries in the "area_SQL.txt" file.

Off the top of my head I would say there must have been a problem when you ran the "psql -d postgis -h localhost -U postgres -p -f nhd_area.sql" or "shp2pgsql "C:\your_map_directory\nhd\NHDArea.shp" NHD_Area > nhd_area.sql" commands prior to this step.  You could try going back and re-running them, maybe dropping the database and rebuilding one form the template to make sure you are starting with a clean slate.

-Oz-

The two posters above are correct.

Krellor: he's not using a program; he's using the tutorial and the code inside area_sql.txt is: ALTER TABLE nhd_area ADD COLUMN mp_type character varying(50);
ALTER TABLE nhd_area ALTER COLUMN mp_type SET STORAGE EXTENDED;
ALTER TABLE nhd_area RENAME COLUMN gnis_name TO name;
DELETE FROM nhd_area WHERE fcode = '53700' or fcode = '30700' or fcode = '31800' or fcode = '34300' or fcode = '34305' or fcode = '34306' or fcode = '36400' or fcode = '37300' or fcode = '56800' or fcode = '43100' or fcode = '45400' or fcode = '45401' or fcode = '45402' or fcode = '45403' or fcode = '45404' or fcode = '46100' or fcode = '48500' or fcode = '40300' or fcode = '40307' or fcode = '40308' or fcode = '40309';
UPDATE nhd_area SET mp_type = '0x28' WHERE fcode = '31200' or fcode='44500';
UPDATE nhd_area SET mp_type = '0x49' WHERE fcode = '33600' or fcode = '33601' or fcode = '33602';
UPDATE nhd_area SET mp_type = '0x3b' WHERE fcode = '36200' or fcode='39800' or fcode='45500';
UPDATE nhd_area SET mp_type = '0x49' WHERE fcode = '46000' or fcode = '46006';
UPDATE nhd_area SET mp_type = '0x46' WHERE (fcode = 46000 or fcode = 46006) and areasqkm >= 15;
UPDATE nhd_area SET mp_type = '0x47' WHERE (fcode = 46000 or fcode = 46006) and areasqkm >= 10 and areasqkm < 15;
UPDATE nhd_area SET mp_type = '0x48' WHERE (fcode = 46000 or fcode = 46006) and areasqkm >= 2 and areasqkm < 10;
UPDATE nhd_area SET mp_type = '0x4c' WHERE fcode = '46003' or fcode='48400';
DELETE FROM nhd_area WHERE mp_type IS NULL;


So, first thing that pops out at me is did you run these two commands:
shp2pgsql "C:\your_map_directory\nhd\NHDArea.shp" NHD_Area > nhd_area.sql
if so that should have given you nhd_area.sql
then run this one:
psql -d postgis -h localhost -U postgres -p -f nhd_area.sql (you may/not need the -p)
That should put the data into the database.

Now, open pgadmin III (its in the postgresql folder) connect to your server, go to the postgis database, go to schemas, go to public, then expand tables.  you should have a table called nhd_area; does it exist?

If it does exist then its case sensative these days and I'll have to fix the steps; if it doesn't.  Then the error is in the second step posted above where it loads.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

-Oz-

Quote from: Tsnake on January 17, 2009, 11:21:35 AM
I don't think I can help you with this, but I have just finished an Illinois map and posted it to this site yesterday.  It contains topo, water, roads, federal lands, and state parks.  I am currently processing just topo and water data and will post that map when it completes.

Hope you don't mind but I just updated the text on your map to be more descriptive; very similar to how I write up my own maps :)  Edit as you see fit.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

msbell1

Thanks very much for your replies. I guess I didn't quite follow the instructions to the letter, as I didn't put quotation marks around the "C:\your_map_directory\nhd\NHDArea.shp" part in the command prompt. Doing that made all the difference. Although I guess there's really no need for me to continue with this Illinois map. (Nice map, by the way! It shows the 1 acre pond by my house!) But I think I'll go ahead with it just to make sure I can create a topographic map.

Thanks again for your help! I wouldn't be surprised if I have to post here again before I finish.

-Oz-

Yes, the " are very important if your directory has spaces in it.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

n2stitch

Are the " important if there are no spaces in the directory name?

dhisum_dhisum

The double quotes are needed because windows needs to identify the entire path as a single element. When the path has spaces but not the double quotes around it, each space separated part is treated as a separate option. That will cause confusion. To be safe, always put double quotes around your paths. That way you would not have to think whether or not your path has spaces.

n2stitch

Thank you very much for the information.  I'm a very unlikely candidate for all this computer processing stuff because frankly, I'm clueless.  But I'm willing to try!

Lalita

-Oz-

the double quotes won't harm it either way but there is always the possibility of hindering so I'd just leave them.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!