[postgis-devel] LINESTRING from A to B to A, bug or feature?
Sakari A. Maaranen
sam at iki.fi
Tue Feb 2 09:09:08 PST 2010
I'm developing a data converter from OSM XML to PostGIS database and
testing (visualizing) the data with GeoServer. For test data I'm using
an OSM extract of Malta.
When I import the data and try to view it using GeoServer Preview
Layer function, OpenLayers complains about internal error:
Error rendering feature
null
I managed to trace down the probelm to a single map feature that is
the linestring id=257482 below.
Obviously the problem with that geometry is that it is a closed "ring"
of only two points, back and forth between those points.
It seems that the node id=325699224 is used twice in the OSM way
id=29551661 (sequence numbers 6 and 8 below).
Now I'm not sure where's the bug?
1. Is it a bug in PostGIS JDBC extension that allows creating such a
LineString. Shouldn't it throw an exception?
I'm using the org.postgis.LineString(Point[] points) constructor
that does not complain.
2. If it's valid geometry, shouldn't OpenLayers be able to render it?
3. Is it a bug in OSM data? Probably not because OSM doesn't have a
very strict specification, and it's legal to use the same node
multiple times.
I will need to work around it anyway... (or fix it, if it's a bug in
my converter that doesn't manage this special case yet.)
Br,
Sakari Maaranen
{{{
routing_test=# select id,way,source,target,astext(geom) FROM
pgrouting_edges WHERE way=29551661;
id | way | source | target |
astext
--------+----------+-----------+-----------+----------------------------------------------------------------------------------------------------
257480 | 29551661 | 325699200 | 325699230 | LINESTRING(14.2465489
36.041279,14.2469467 36.0411728,14.2471291 36.041092)
257481 | 29551661 | 325699230 | 325699224 | LINESTRING(14.2471291
36.041092,14.2473653 36.0409924,14.2474878 36.0409788,14.2475609
36.0409991)
257482 | 29551661 | 325699224 | 325699224 | LINESTRING(14.2475609
36.0409991,14.2478792 36.0410809,14.2475609 36.0409991)
257483 | 29551661 | 325699224 | 325699225 | LINESTRING(14.2475609
36.0409991,14.2477134 36.0405635)
(4 rows)
routing_test=# select * from osm_way_nodes where id=29551661;
id | nd | sequence
----------+-----------+----------
29551661 | 325699200 | 1
29551661 | 325699220 | 2
29551661 | 325699230 | 3
29551661 | 325699221 | 4
29551661 | 325699222 | 5
29551661 | 325699224 | 6
29551661 | 325699223 | 7
29551661 | 325699224 | 8
29551661 | 325699225 | 9
(9 rows)
routing_test=# select k,v from osm_way_tags where id=29551661;
k | v
---------+------------------
source | Yahoo;gps;survey
highway | service
(2 rows)
}}}
More information about the postgis-devel
mailing list