GPSFileDepot.com
 

News:

Welcome to GPSFileDepot!

Main Menu

Data Search and Replace Question

Started by Seldom, December 16, 2011, 09:04:01 AM

Previous topic - Next topic

Seldom

I posted this at the GM group and it still hasn't had an answer, so I'm hoping somebody here may be able to help me out. 

I have 5000 roads named 30???.  I'd like to rename them all ???, which should reflect the actual signage for the roads.  If I do a search and replace in GM and put ??? in the replace string I get 5000 roads named "???", not the numbers I want to remain.  Is there a wild card format that would permit this?

Boyd

#1
Not sure that I understand what you want, but powerful though the Globalmapper search feature is, I often find it can't do something I want. In that case, I export a shapefile and use FileMaker Pro to massage the .dbf.

Seldom

#2
I tried this in MSAccess, and couldn't figure it out there either.  I'm thinking the easiest solution would be to open it in OpenOffice subtract 30,000 from all the values and save it as a DBF.


-Oz-

Load them into PostGIS and then do a SQL query where name=right(name,3) and it'll change all the names to just be the left-most 3 characters.
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!

Seldom

This is my first attempt with PostGreSql.  When I run the following batch file (copied from Oz's Hydrography tutorial) I get a "DBF file cannot be opened" message and an empty roads.sql file in my dixieNFRoads folder.


path="c:\program files (x86)\postgresql\9.0\bin\";%path%
shp2pgsql.exe "c:\maps-homemade\data\ut\ut forests\dixie\dixieNFRoads\Roads.shp" Roads>roads.sql
pause

-Oz-

Do you have the file open in Global Mapper or any other program that may have locked the file?
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!

Seldom

I just re-booted and got the same error message.  If the file's locked, I don't know where to look for a lock file.  That command line should work for PostGreSql 9.0 shouldn't it?

maps4gps

I get that message with some software if I changed the file to 'read-only' to keep from accidentially deleting it.

Seldom

#8
The "read only" box was not set. 

I've actually got the PostGIS-GUI plug in installed in pgAdmIII and I've successfully imported using the GUI.  I got an error message when I tried to import the shapefile until  I copied the PostGIS database to a new database and used the plugin to import to that.  That created 3 tables, Roads, Geometry Columns, and Spatial Ref Sys, with no error messages.

I can view the column I want to change, but haven't figured out yet how to make Oz's query work.  I get an "unexpected character" message at the start of the query.  Guess I'll have to learn some SQL.

Also need to figure out how to export the finished product to DBF.  After the import, I can't find a "roads.sql" anywhere on my C: drive.

maps4gps

OZ's code was for a character field.  Are all the entries numeric? 
If so, GM would have made the field numeric if it created the .dbf file.

-Oz-

My tutorial has the export commands.
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!

Seldom

Quote from: -Oz- on December 17, 2011, 03:39:29 PM
My tutorial has the export commands.

I just reviewed your PostgreSQL tutorial.  When I downloaded PostgreSQL the version available was 9.1, and PostGIS 1.5 was the only Spatial Extension.  Also, when I built the database, the only character set I could select was UTF8 (also in the template).  If I tried to select WIN1252 I got an error saying that I had to match the template.

-Oz-

That shouldn't change the commands.  Did you try this?
pgsql2shp  -f "C:\your_map_directory\transportation\table.shp" -u postgres -p postgis table
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!

Seldom

Finally got everything working.  The PostGreSQL installation has two top level folders, 9.0 and 9.1.  Both of those folders have a BIN subfolder which contains shp2pgsql.exe and pgsql2shp.exe.  However only the 9.1\BIN contains all the DLLs necessary for them to run.  Also, I was trying to run it from a remote directory via a batch file by adding 9.1\BIN to the path.  Didn't work but when I ran it from the 9.1\BIN directory it did.

Are there any native viewers to view the geometry (like GM), or do I have to export it back to shapefiles to see it?.