Tag Info

Hot answers tagged

23

If you have a Windows computer, you can use good 'ol CMD.EXE with a few esoteric for-loops. Make sure you do this in a "contained" directory with only the shp/sql files that you need to load. First step, create the SQL loader files (I also assumed you have Lat/Long WGS84 data with 4326 .. update this to your SRS): for %f in (*shp) do shp2pgsql -s 4326 %f ...


7

If you want a painless install, you might want to start over and use the OpenGeo Suite version of PostGIS. $sudo wget -qO- http://apt.opengeo.org/gpg.key | apt-key add - $sudo echo "deb http://apt.opengeo.org/ubuntu lucid main" >> /etc/apt/sources.list $sudo apt-get update $apt-cache search opengeo $sudo apt-get install opengeo-postgis Or you could ...


7

If you are working on your workstation it's more a matter of taste. Knowing how to use psql is useful for some situations like running sql scripts from files, pipe it with other tools, etc. It depends on your needs. My everyday work is done using pgAdmin and I only go down to the CLI when needed. On the other hand psql is sometimes your only option when ...


6

I guess you are a victim of the fact that spatially enabling a PostgreSQL db with PostGIS creates a bunch of functions in the "public" namespace. If you backup the public namespace and then restore it to a PostGIS db these functions will already exist, causing errors. As Paul Ramsey wrote (in a blog post explaining the issue in detail and giving advice): ...


4

While I have not actually installed it, I had read about the pgAdmin plugin called "PostGIS viewer" referenced here (2010), here (2011), and here (2012). The first request to add something like this (that I found) was ticket #485. The 2012 SQL console for the pgAdmin plugin: PostGIS viewer by German Carrillo uses the QGIS plugin "Fast SQL Layer", and ...


3

I don't believe the Shapefile loader will work in your case. However, PostGIS comes with a raster loading tool called raster2pgsql. This tool will load any GDAL supported raster format into PostGIS Raster. It is a command-line tool so to execute it you just need to run: raster2pgsql raster_options schema.table_name > output.sql So, the tool will take ...


3

PgAdmin has limits on the largest object it can display in a table cells. Large geometries frequently exceed this limit, which results in an "empty" cell, confusing to new users. If you call ST_NPoint(geom) or ST_GeometryType(geom) you can see that the geometry is in fact there, and does have data in it, you just cannot see it in a PgAdmin cell.


3

Yes, absolutely. PostgreSQL is set up to only accept local connections, and GeoServer is set up to use the loopback address i.e. 127.0.0.1 on port 8080. So you can run the standard installers and everything should just work when you type: http://localhost:8080 You'll need to set up GeoServer to see your PostgreSQL database, but that's standard stuff ...


2

I can't believe I'm having the same issue in 2014 with 12.04. Neither the GUI nor command-line shapeloader install using the opengeo-suite. I simply followed the noob-friendly directions on this website: http://www.staygeo.com/2013/05/enabling-postgis-shapefile-and-dbf.html, which parallel the instructions by RK almost 2 years ago. "Install ...


2

Any table in the instance can be registered with sde. But sde is what has to do that registration. I suggest starting with this Essential Reading for Geodatabases Registering with the database


2

The easiest would be to setup PostgreSQL user group roles and assign permissions based on those roles. It's a lot easier in PostgreSQL 9.0+ since you can use DEFAULT PRIVILEGES. --this will take care of future tables in a database ALTER DEFAULT PRIVILEGES GRANT ALL ON TABLES TO gisadmins; -- this will take care of existing tables in public schema. As I ...


2

I just figured out that one of my earlier approaches would have worked, but I had a typo in my postgres query. Right-click and copy the binary hex string from SQL Server Management Studio. Paste into a string in the PG Admin III SQL Editor window. Delete the "0x" at the beginning of the string. Wrap that value with a decode. Now ST_GeomFromWKB has WKB. ...


1

The pgRouting workshop gives a simple example how to return the path geometries. But this would work in the same way for any other attribute: SELECT seq, id1 AS node, id2 AS edge, cost, b.the_geom FROM pgr_dijkstra(' SELECT gid AS id, source::integer, target::integer, ...


1

Yes. that SELECT gid as gid .... is the magic part.If you have have "name" column in your table you can just add SELECT gid as gid, name as road_name ... FROM tablex if your name column is on another table then you need to to something like this. SELECT a.gid as gid , b.name as name ... FROM tablex as a , nametable as b WHERE a.gid = b.gid (or you can do ...


1

I decided to go ahead and use the command line utility (shp2pgsql) to import my .shp file. Since I was able to get it working without too much trouble and a little Googling around I wanted to share this possible solution for anyone else who just wants to import a .shp file into Postgres and didn't want to deal with the hassle of trying to get pgadmin's GUI ...


1

It looks like the loader you're using is from 1.5 or lower, while the database you're loading to is 2.0. Either (a) move to the latest loader or (b) add the "legacy.sql" file into your postgis database to ensure that all the old function signatures the old loader expects are available to you.


1

The problem is with "NAME_3" = NULL, since NULL is not "equal to" NULL. This should instead use the proper SQL construct "NAME_3" IS NULL. See the documentation for more details.



Only top voted, non community-wiki answers of a minimum length are eligible