Hi,
You may start with reading this:
http://geoserver.org/display/GEOSDOC/PostGIS+DataStore
It gives information about the importance of having primary key, how to create and register PostGIS views as FeatureType etc. I am not a PostGIS specialist but I believe that at least tables imported with osm2pgsql should be spiced with primary keys by using these two commands:
alter table <tablename> add column fid serial;
ALTER TABLE <tablename> ADD CONSTRAINT fid_pkey PRIMARY KEY (fid);
You can also create new physical tables, kind of an equivalent to
materialized views in Oracle by psql commands like this:
DROP TABLE osm_primary;
CREATE TABLE osm_primary
WITH OIDS
TABLESPACE pg_default
AS
(SELECT osm_id, way, highway, ref, name FROM osm_line
WHERE highway='primary' OR highway='primary_link');
I am not sure if this is any better than having just views. At least I can use these psysical tables also during a new import which is first dropping the line, point and polygon tables. Actually I believe that if I had views then I should drop them manually before running osm2pgsql. Osm2pgsql starts with dropping the old tables with DROP TABLE command and it does not do anything if tables have views or other dependencies.
-Jukka Rahkonen-
-----Alkuperäinen viesti-----
Lähettäjä: Roman Isitua [mailto:romanisitua@anonymised.com]
Lähetetty: ke 7.5.2008 12:16
Vastaanottaja: Rahkonen Jukka
Kopio: geoserver-users@lists.sourceforge.net
Aihe: Re: [Geoserver-users] osm to postgis data import issue
Hi,
How are u doing that ? I mean "creating new tables or views to be used with Geoserver". I am asking this because my purpose for importing osm data into postgis was to use it with geoserver. Are u saying that the data cannot be imported directly into geoserver in its present form i.e. after importing into postgis ?
Thanks,
Roman
Rahkonen Jukka <Jukka.Rahkonen@anonymised.com> wrote:
Hi,
It might be good to know some issues:
- Osm2pgsql does not create primary key for the tables it is creating even they would be useful of even compulsory sometimes.
- There is no column in the imported tables that can be used as primary key. At least not in the "line" table, because multipart ways are getting split into several features all sharing the same osm_id.
- If QGis is to be used as a WFS client it is good to know that it requires OID field.
I am using osm2pgsql for importing the raw data and next I am creating new tables or views to be used with Geoserver or Mapserver. In that way I can create primary keys or OIDs if they are needed and clean away those OSM tags that I am not going to use.
-Jukka-
________________________________
Lähettäjä: Roman Isitua [mailto:romanisitua@anonymised.com]
Lähetetty: ti 6.5.2008 13:52
Vastaanottaja: Rahkonen Jukka
Kopio: geoserver-users@lists.sourceforge.net
Aihe: Re: [Geoserver-users] osm to postgis data import issue
Hi,
I tried it and it worked thanks.
Rahkonen Jukka wrote:
Hi,
I got it working by setting pg_hba.conf file with pgAdmin utility so that password is not required for local users.
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust
-Jukka Rahkonen-
-----Alkuperäinen viesti-----
Lähettäjä: geoserver-users-bounces@lists.sourceforge.net puolesta: Roman Isitua
Lähetetty: ma 5.5.2008 15:31
Vastaanottaja: geoserver users
Aihe: [Geoserver-users] osm to postgis data import issue
hi guys,
I have some osm data that i want to import into postgis. I followed the instructions in the "User talkJRA - OpenStreetMap" page . I created a user in postgis with the same name as my windows user. (with no password) (As stated in the instruction the utility connects always with the default user name). I did this but when I ran the command osm2pgsql -d osmdatabasename osmdumpname. I got the following error on my command prompt "Connection to database failed: fe_sendauth: no password supplied" i.e. i think this means i did not supply a password.
How do I resolve this issue ? my windows user does not have a password. Do I have to assign a password to my windows user ? Need some help here.
Thanks,
Roman.
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.