Re: [osmosis-dev] [Talk-us] Cloudmade california.osm: dups or osmosis bug?

2010-05-21 Thread andrzej zaborowski
Hi Mike,
good catch, I forgot to add the ...Factory.java file.  Hopefully I
haven't forgotten any more files.

Cheers

On 22 May 2010 04:08, Mike N. nice...@att.net wrote:
 Hi andrzej,

  I tried to apply the patch, but I get an undefined symbol when trying to
 build 'FlattenFilterFactory'.   Am I missing part of the patch or is there
 another setting to create the Factory?

  Thanks,

  Mike Nice

 --
 From: andrzej zaborowski balr...@gmail.com
 Sent: Friday, May 21, 2010 2:40 PM
 To: David Carmean d...@halibut.com
 Cc: osmosis-dev@openstreetmap.org; OSM US Talk
 talk...@openstreetmap.org
 Subject: Re: [Talk-us] Cloudmade california.osm: dups or osmosis bug?

 Hi,

 On 21 May 2010 01:54, David Carmean d...@halibut.com wrote:

 Is it the dataset or osmosis that is giving me a single 2-node duplicate
 for each postGIS table created by osmosis?

 Not sure if it's related, but I noticed that many of the CloudMade
 extracts can't be processed using osmosis (even though they're
 generated with osmosis), except for the operations that don't try to
 validate the order of elements.  It seems they often contain
 consecutive elements with the same id, but possibly different version.
 I have a little patch (attached) to add a new filter (--ff) that
 flattens the file.  It does the same operation on sorted entity
 streams as --simplify-change does on change streams, unfortunately
 --simplify is taken by a different operation now.  I decided it was
 faster to modify osmosis than to download the planet and make my own
 un-broken extracts.

 Cheers
 (I'm not subscribed to osmosis-dev)




 ___
 Talk-us mailing list
 talk...@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/talk-us


Index: src/org/openstreetmap/osmosis/core/filter/v0_6/FlattenFilter.java
===
--- src/org/openstreetmap/osmosis/core/filter/v0_6/FlattenFilter.java	(revision 0)
+++ src/org/openstreetmap/osmosis/core/filter/v0_6/FlattenFilter.java	(revision 0)
@@ -0,0 +1,91 @@
+/* This software is released into the Public Domain.
+ * See copying.txt for details.  */
+package org.openstreetmap.osmosis.core.filter.v0_6;
+
+import org.openstreetmap.osmosis.core.container.v0_6.BoundContainer;
+import org.openstreetmap.osmosis.core.container.v0_6.EntityContainer;
+import org.openstreetmap.osmosis.core.container.v0_6.EntityProcessor;
+import org.openstreetmap.osmosis.core.domain.v0_6.Entity;
+import org.openstreetmap.osmosis.core.task.v0_6.Sink;
+import org.openstreetmap.osmosis.core.task.v0_6.SinkSource;
+
+
+/**
+ * Flatten / simplify a sorted entity stream.
+ * (similar to --simplify-change)
+ */
+public class FlattenFilter implements SinkSource {
+	private Sink sink;
+	private EntityContainer previous_container;
+
+	/**
+	 * Creates a new instance.
+	 */
+	public FlattenFilter() {
+	}
+
+	/**
+	 * Process a node, way or relation.
+	 *
+	 * @param current_container
+	 *The entity container to be processed.
+	 */
+	public void process(EntityContainer current_container) {
+		if (previous_container == null) {
+			previous_container = current_container;
+			return;
+		}
+
+		Entity current = current_container.getEntity();
+		Entity previous = previous_container.getEntity();
+
+		if (current.getId() != previous.getId() ||
+current.getClass() != previous.getClass()) {
+			sink.process(previous_container);
+			previous_container = current_container;
+			return;
+		}
+
+		if (current.getVersion()  previous.getVersion())
+			previous_container = current_container;
+	}
+
+	/**
+	 * Process the bound.
+	 *
+	 * @param boundContainer
+	 *The bound to be processed.
+	 */
+	public void process(BoundContainer boundContainer) {
+		/* By default, pass it on unchanged */
+		sink.process(boundContainer);
+	}
+
+	/**
+	 * {...@inheritdoc}
+	 */
+	public void complete() {
+		/*
+		 * If we've stored entities temporarily, we now need to
+		 * forward the stored ones to the output.
+		 */
+		if (previous_container != null)
+			sink.process(previous_container);
+
+		sink.complete();
+	}
+
+	/**
+	 * {...@inheritdoc}
+	 */
+	public void release() {
+		sink.release();
+	}
+
+	/**
+	 * {...@inheritdoc}
+	 */
+	public void setSink(Sink sink) {
+		this.sink = sink;
+	}
+}
Index: src/org/openstreetmap/osmosis/core/filter/v0_6/FlattenFilterFactory.java
===
--- src/org/openstreetmap/osmosis/core/filter/v0_6/FlattenFilterFactory.java	(revision 0)
+++ src/org/openstreetmap/osmosis/core/filter/v0_6/FlattenFilterFactory.java	(revision 0)
@@ -0,0 +1,26 @@
+/* This software is released into the Public Domain.
+ * See copying.txt for details.  */
+package org.openstreetmap.osmosis.core.filter.v0_6;
+
+import org.openstreetmap.osmosis.core.pipeline.common.TaskConfiguration;
+import org.openstreetmap.osmosis.core.pipeline.common.TaskManager;
+import 

Re: [OSM-dev] TRAPI down?

2010-05-21 Thread Tom Hughes
On 21/05/10 13:22, Patrick Kilian wrote:

 we currently see LOTS of INFO Reset tileset Cause: Download of data
 failed from API,TRAPI,ROMA in the stats of the ti...@home clients looks
 like the TRAPI server(s) are currently down and the main API can't feed
 the resulting flood in batch requests. The logs suggest that this
 happened about 30 minutes ago. Does anybody know what exactly broke and
 can perhaps even fit it?

You won't get anything from the main API certainly - it hasn't allowed 
any requests from ti...@home for months.

Tom

-- 
Tom Hughes (t...@compton.nu)
http://compton.nu/

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] TRAPI down?

2010-05-21 Thread Jeremy Adams

 Hi all,

 we currently see LOTS of INFO Reset tileset Cause: Download of data
 failed from API,TRAPI,ROMA in the stats of the ti...@home clients looks
 like the TRAPI server(s) are currently down and the main API can't feed
 the resulting flood in batch requests. The logs suggest that this
 happened about 30 minutes ago. Does anybody know what exactly broke and
 can perhaps even fit it?


 Patrick Petschge Kilian


My TRAPI server is struggling with what looks like a corrupted DB.  It may
need to be taken down for a rebuild.  The other server is up, but may be
slow since it's serving all of the t...@h clients.

We could always use another server to spread the load...

-Jeremy
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


[OSM-dev] I have created software for processing OSM data into networked graph structure

2010-05-21 Thread Daniel Lissner
Hello OSM developers,
I am a computer scientist researcher at the University of Memphis
Computer Science Dept. In a recent project, we needed a representation
of the road network which would provide us with information about
connectivity and distance between sections of road. We found that the
OSM data provided a suitable platform to build such a graph-like
structure.
I have written a java program to process the XML format OSM data and
achieve this. Currently, each sequential pair of nodes referenced in
the WAY elements of roads are considered as a section of road. their
lat/long coords are passed to a method to calculate their distance via
law of spherical cosines and haversine formula. After every Way in the
dataset is processed, another method populates adjacency and incidence
information. Each road section (essentially a graph edge) knows
which road sections it is adjacent to, the two node points that make
its end points, its distance, it's heading (in respect to North) and
its street name. Thus far we are not very concerned with other
metadata but it's certainly feasible n possible to include. Further,
each node (essentially a graph vertex) knows its reference number, its
lat/lng coords, and all of the road sections which are incident to it.
The purpose of this structure for us was to serve as a state model for
simulations for our research work. While I'm not at liberty to share
all of our research purposes at this time, I am however able to share
the code I wrote which processes the osm data and creates a graph
structure of the road network.
The first version simply instantiates and populates several java
objects, which we tried to design and code as clean and efficiently as
possible. We are now migrating the processor to instead store the data
in a MySQL database.
So, I am writing the mailing list to ask if the osm developer
community would find any use for this little utility which creates a
connected graph structure of Ways, either as a straightforward set of
java objects or as a MySQL database. OSM has benefited our research
and I would certainly like to give back.

Thanks,
Daniel

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] I have created software for processing OSM data into networked graph structure

2010-05-21 Thread jamesmikedup...@googlemail.com
lets see the c0d3!

On Sat, May 22, 2010 at 1:15 AM, Daniel Lissner dliss...@gmail.com wrote:

 Hello OSM developers,
 I am a computer scientist researcher at the University of Memphis
 Computer Science Dept. In a recent project, we needed a representation
 of the road network which would provide us with information about
 connectivity and distance between sections of road. We found that the
 OSM data provided a suitable platform to build such a graph-like
 structure.
 I have written a java program to process the XML format OSM data and
 achieve this. Currently, each sequential pair of nodes referenced in
 the WAY elements of roads are considered as a section of road. their
 lat/long coords are passed to a method to calculate their distance via
 law of spherical cosines and haversine formula. After every Way in the
 dataset is processed, another method populates adjacency and incidence
 information. Each road section (essentially a graph edge) knows
 which road sections it is adjacent to, the two node points that make
 its end points, its distance, it's heading (in respect to North) and
 its street name. Thus far we are not very concerned with other
 metadata but it's certainly feasible n possible to include. Further,
 each node (essentially a graph vertex) knows its reference number, its
 lat/lng coords, and all of the road sections which are incident to it.
 The purpose of this structure for us was to serve as a state model for
 simulations for our research work. While I'm not at liberty to share
 all of our research purposes at this time, I am however able to share
 the code I wrote which processes the osm data and creates a graph
 structure of the road network.
 The first version simply instantiates and populates several java
 objects, which we tried to design and code as clean and efficiently as
 possible. We are now migrating the processor to instead store the data
 in a MySQL database.
 So, I am writing the mailing list to ask if the osm developer
 community would find any use for this little utility which creates a
 connected graph structure of Ways, either as a straightforward set of
 java objects or as a MySQL database. OSM has benefited our research
 and I would certainly like to give back.

 Thanks,
 Daniel

 ___
 dev mailing list
 dev@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/dev

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev