[Qgis-user] QGIS Openstreetmap plugin

Jo winfixit at gmail.com
Sat May 18 10:51:51 PDT 2013


Hi,

I'm a long time Openstreetmap contributor trying to wrap my brain around
understanding how to work with QGIS. Quite likely this means I follow the
opposite path of most.

I managed to convert WFS to SHP, load that SHP in JOSM, the java
openstreetmap editor and in PostGIS. Translating latin1 to UTF8 and
Lambert72 to WGS84. Even , to . as the decimal operator.

I also found how to style the data in the shape files.

So far so good.


Now I read the chapter in the manual on how to work with OSM data directly
in QGIS. What I'm missing is a way to work with the tags on the nodes and a
way to visualise route relations.

The best way is probably to give a concrete example. We have cycle node
networks. The nodes have rcn_ref tags, usually integers, sometimes START.

The nodes are members in network relations.

The ways between the nodes are members of route relations

The route relations are also members of the network relations.

I want the colour of the buffer around the nodes to be dependent on the
network relation they belong to.

I want the caption along the routes to come from the note tag of the route
relations. And I want to draw a buffer along their paths.

Is there a way to access the tags of the relations and the nodes?

Further down the line, I would love to be able to use QGIS to draw
spiderlike network diagrams of public transportation networks. With ways
coloured based on the bus lines passing there, 7 colours with an offset.



At some point I may write a Python plugin myself to work with OSM data. All
the data would be stored in PostGIS. Only the nodes would have geometries,
which can be uploaded to the OSM server. Ways would have geometries.
Relations would have geometries based on their type. But if ways or
relations are changed the geometry gets updated at the nodes level. Then
all geometries which use those nodes will have to be recalculated (with a
trigger function in PostGIS, I guess). I have no idea if such a solution
would be able to scale. Especially as I would also like to store historic
versions of the nodes, ways and relations in that DB.

The nodes layer would show all the nodes, not only the ones which have no
tags. Labels can be queried from the tags in the relations table as well

The ways layer would show all the non closed ways, not sure about the
roundabouts. Maybe all the ways which aren't areas.

The polygons layer would show all the closed ways (areas) and the
multipolygon relations. The buildings, the landuse, the boundaries.

The routes layer would show all the route relations


I have been giving this some thought:

CREATE TABLE users
(
  userid integer PRIMARY KEY,
  username text
)
WITH (
  OIDS=FALSE
);
ALTER TABLE users
  OWNER TO "Jo";

CREATE TABLE changesets
(
  csid integer PRIMARY KEY,
  cs_userid integer REFERENCES users,
  csts timestamp
)
WITH (
  OIDS=FALSE
);
ALTER TABLE changesets
  OWNER TO "Jo";

CREATE TABLE nodes
(
  nodeid bigint PRIMARY KEY,
  nd_csid integer REFERENCES changesets,
  ndversion integer,
  --ndts timestamp,
  geog geography
)
WITH (
  OIDS=FALSE
);

CREATE TABLE ways
(
  wayid integer PRIMARY KEY,
  wy_csid integer REFERENCES changesets,
  wyversion integer
  --wyts timestamp
)
WITH (
  OIDS=FALSE
);

CREATE TABLE rels
(
  relid integer PRIMARY KEY,
  rl_csid integer REFERENCES changesets,
  rlversion integer
  --rlts timestamp
)
WITH (
  OIDS=FALSE
);

CREATE TABLE keys
(
  keyid bigserial PRIMARY KEY,
  k text
)
WITH (
  OIDS=FALSE
);
CREATE TABLE vals
(
  valueid bigserial PRIMARY KEY,
  v text
)
WITH (
  OIDS=FALSE
);
CREATE TABLE tags
(
  tagid bigserial PRIMARY KEY,
  tg_nodeid bigint REFERENCES nodes,
  tg_wayid bigint REFERENCES ways,
  tg_relid bigint REFERENCES rels,
  tg_keyid bigint REFERENCES keys,
  tg_valueid bigint REFERENCES vals
)
WITH (
  OIDS=FALSE
);

CREATE TABLE waynodes
(
  wnid bigserial PRIMARY KEY,
  wn_way bigint REFERENCES ways,
  wn_node bigint REFERENCES nodes
)
WITH (
  OIDS=FALSE
);

CREATE TABLE relnodes
(
  rnid bigserial PRIMARY KEY,
  rn_rel bigint REFERENCES rels,
  rn_node bigint REFERENCES nodes
)
WITH (
  OIDS=FALSE
);

CREATE TABLE relways
(
  rwid bigserial PRIMARY KEY,
  rw_rel bigint REFERENCES rels,
  rw_way bigint REFERENCES ways
)
WITH (
  OIDS=FALSE
);

CREATE TABLE relrelations
(
  rrid bigserial PRIMARY KEY,
  rr_parent bigint REFERENCES rels,
  rr_child bigint REFERENCES rels
)
WITH (
  OIDS=FALSE
);


Until now I was considering to program this as stored procedures in PostGIS
and with Python from the command line, but it may make a lot more sense to
write a QGIS plugin in Python.

My goal is not only to be able to work with the data and visualise it. I
also need to find a way to prepare open data, available as shape files and
WFS, for integration in Openstreetmap and subsequently to do quality
control on it and to assure we keep current with changes coming from
upstream and the ability to create feedback reports on changes coming from
the OSM contributors, once they are vetted as genuine.

I'd love to hear your thoughts on all this. I wouldn't be surprised if
there's something I didn't think about.

Kind regards,

Polyglot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130518/0053b996/attachment.html>


More information about the Qgis-user mailing list