Im using the tool osm2pgsql to import an osm file into a postgres database using phppgadmin as the administrative tool. i have only downloaded a small town from osm in xml format and im having trouble importing it using the terminal on mac. Im a bit of a noob at this so any help would be greatly appreciated. Ive looked at several articles but none provide the clarity i need in order to fulfill my needs.
Thanks
im getting this error could be something small not sure..
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE: table "planet_osm_point" does not exist, skipping
NOTICE: table "planet_osm_point_tmp" does not exist, skipping
SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, 'POINT', 2 );
failed: ERROR: function addgeometrycolumn(unknown, unknown, integer, unknown, integer) does not exist
LINE 1: SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
You need to install the postgis extensions into your postgres database. Assuming that you have postgis installed on your machine you need to do something like:
psql <database> < /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
The exact path to postgis.sql will depend on the distribution you are using and how it has packaged postgis. You may also want/need to install the spatial reference systems table with a command like this:
psql <database> < /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
This is an example command:
osm2pgsql -c -d your_country -U postgres -W -H localhost -P 5432 -s -k -x -p osm -S default.style ..\your_country.osm.bz2
Here are some useful weblinks:
http://wiki.openstreetmap.org/wiki/Osm2pgsql
http://www.gis.hsr.ch/wiki/Osm2pgsql
-S.
Related
I have been trying to import my SRTM raster data into my postgis using the command, but has generated the following error (tried multiple times). Is there any thing missing? I appreciate for any help
Error message:
ERROR: relation "test" already exists
ERROR: current transaction is aborted, commands ignored until end of transaction block
Welcome to SO.
The error message says you're trying to create a relation that already exists. Either drop it in your database ..
DROP TABLE test;
.. or tell raster2pgsql to do it for your by adding the parameter -d to your command.
-d Drops the table, then recreates it and populates
Something like
raster2pgsql -I -z 10x10 -C -F -s 4326 file.hgt -d public.test | psql ...
An alterative is to use -a to append the data to an existing table
-a Appends raster into current table, must be exactly the same table schema.
I'm fairly new to PostGIS. I've imported a shp file countless times in different ways. Here's my latest attempt.
shp2pgsql -d -s 4269 /var/www/Shape/Hamilton_City/Election_Poll_Boundaries.shp city_hamilton | psql -U postgres -d shape
I'm importing to srid 4269 because the .prj file says:
GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
When I do any type of search on the geometry of the polygons as in:
select ST_Astext(geom) AS coordinates FROM city_hamilton limit 1;
I get odd coordinates like:
MULTIPOLYGON(((574380.4001 4808575.0399,574434.7803 4808545.44,574496.2521 4808512.3351,.....
What am I doing wrong here?
I work with postgresql boosted with timescaledb fork (pretty impressed with its performance while it worked ;)
I got a script that downloads data, modifies it and puts into a csv file.
Then a psql script is invoked to create a temp table that inserts data into the database
psql -U postgres -d q1 -c "CREATE TABLE tmpp (time bigint NOT NULL, ask real NOT NULL, bid real NOT NULL)"
psql -U postgres -d q1 -c "\copy tmpp (time, ask, bid) from '/sth/sth.csv' delimiter ',' CSV"
psql -U postgres -d q1 -c "insert into realfun select * from tmpp"
psql -U postgres -d q1 -c "DROP TABLE tmpp"
Funny thing is, that it worked for me before, but now I got an error :
ERROR: Deprecated trigger function should not be invoked
I must have messed up sth, but cant figure out what it is [how original]
I will be happy to provide more details, if needed
I cannot find anything similar in google, please advise
It seems that the problem is that you have a newer shared library version than the extension version you have installed (Timescale is an extension, not a fork). You can fix this with ALTER EXTENSION timescaledb UPDATE.
The alter command is documented here.
I want to import OSM map into postgis, so used the following command in windows cmd console:
osm2pgsql -U postgres -d osm -hstore -s _S ./default.style ./xxxx.osm
But "illegal option --t" error occus:
osm2pgsql illegal option --t
Usage error.
I don't know what's the meaning of "illegal option --t" and don't know how to handle it.
I've looked at several articles but haven't find any answer.
thanks.
p.s I've installed postgis 2.1.7 and postgresql 9.4 and hstore.
There are at least 2 mistakes in your command -hstore instead of --hstore and _S instead of -S .
So:
osm2pgsql -U postgres -d osm --hstore -s -S ./default.style ./xxxx.osm
I use db2look to export my DDL.
But it cuts off long procedures.
I use the following command:
db2look -td # -d DBNAME -z SCHEMANAME -e -c -o dump.sql
If I use, for example, Toad for DB2, everything is fine.
Depending on what version is reported by the db2level command, you may be able to correct the problem in db2look by applying a Fix Pack to your DB2 installation. What level does db2level say you currently have?
TOAD for DB2 is reading the TEXT column directly from SYSCAT.ROUTINES, which you can also access from a simple program or from DB2's built-in EXPORT utility.