[OSM-dev] osmosis pgsnapshot actions table

Florian Lohoff f at zz.de
Wed Apr 8 12:32:20 UTC 2015


Hi,
iam looking at something like whodidit - Analysis of changesets,
their authors and near realtime monitoring of areas.

Whodidit parses the osc files independent of existing data so
when only ways get modified (without their respective nodes)
you'll miss the update.

I was thinking of using an osmosis based pgsnapshot schema
which i have running anyway and adding the actions tables,
some trigger function magic and there we have the data.

Now i have multiple problems.

- With triggers on the actions table i am unable to fetch
  deleted nodes former geometry. before or after insert on
  the actions table when action is 'D' the node is already gone
  from the nodes table.

- I fail to get the changeset, user and timestamp information.

Did anyone solve this? I had a look at osmosis on extending the
data dumped to the actions table e.g. changeset, user and timestamp
but still the "delete entity" would still exist.

Would something like this reorder the deletion of the way/node/relation
and the insert into the action table?


diff --git a/osmosis-pgsnapshot/src/main/java/org/openstreetmap/osmosis/pgsnapshot/v0_6/impl/EntityDao.java b/osmosis-pgsnapshot/src/main/java/org/openstreetmap/osmosis/pgsnapshot/v0_6/impl/EntityDao.java
index e53539e..59ff9fb 100644
--- a/osmosis-pgsnapshot/src/main/java/org/openstreetmap/osmosis/pgsnapshot/v0_6/impl/EntityDao.java
+++ b/osmosis-pgsnapshot/src/main/java/org/openstreetmap/osmosis/pgsnapshot/v0_6/impl/EntityDao.java
@@ -147,9 +147,9 @@ public abstract class EntityDao<T extends Entity> {
 		args = new HashMap<String, Object>();
 		args.put("id", entityId);
 		
-		namedParameterJdbcTemplate.update(entityMapper.getSqlDelete(true), args);
-		
 		actionDao.addAction(entityMapper.getEntityType(), ChangesetAction.DELETE, entityId);
+
+		namedParameterJdbcTemplate.update(entityMapper.getSqlDelete(true), args);
 	}
 	
 	
Flo
-- 
Florian Lohoff                                                 f at zz.de
     We need to self-defense - GnuPG/PGP enable your email today!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20150408/38794e21/attachment.sig>


More information about the dev mailing list