Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find shp2pgsql?

I'm working on a Debian machine with postgresql installed. I need to find shp2pgsql (a utility that converts shapefiles into SQL, as the name suggests).

I've seem suggestions that it's located in the bin directory of postgresql, however I don't know where to find this. I can't locate shp2pgsql through a simple find (probably much too simple, since my Unix skills are not that good):

$ find ~ -name 'shp2pgsql' -print
$ 

Any suggestions?

Thanks - apologies for the basic question!

like image 678
AP257 Avatar asked Dec 22 '22 00:12

AP257


2 Answers

I'm pretty sure you need PostGIS installed - its part of that package. You can install it from that site, or its likely that Debian's package manager even has it. Where it ends up depends on package builder.

Actually finding it, if its not in your PATH after you install PostGIS, is probably easiest done through locate shp2pgsql although you may need to updatedb first.

Additionally, you can find your Postgres relevant directories by running pg_config .

like image 193
rfusca Avatar answered Jan 01 '23 21:01

rfusca


The first argument to find is the path from which to search. ~ is your home directory. Your command searches shp2pgsql from your home directory, not in the bin directory. With find, user command find /usr/lib/postgresql/ -name shp2pgsql.

If your system has locate installed, you could also locate shp2pgsql.

like image 31
jmz Avatar answered Jan 01 '23 22:01

jmz