We are using osm2pgsql to import the OpenStreetMap's planet.osm file to GeoServer. Then we try to get features from the polygon layer using GDAL/OGR's WFS driver in C#.
We've tried the import with and without the --multi-geometry
option.
The multi-polygon I'm using for testing is http://www.openstreetmap.org/relation/69663. I try to fetch the relevant features with
layer.SetAttributeFilter("(osm_id=69663)OR(osm_id=28414267)OR(osm_id=30407439)");
The above ID's are the relation ID of the multi-polygon, the way ID of the outer way and the way ID of the inner way, respectively. This query returns only a single feature with a single geometry with 22 nodes and no nested geometries. This feature matches the outer way in ID, number of nodes and its tags. This means that not only is it missing the inner way; it is also missing the tags from the relations, which is what identifies it as a building.
What happened with the inner way? Was it discarded because it doesn't have any tags? What happened with the relation? Most importantly, how do I get the result I seek?
EDIT: iant wanted to know what was in the geometry column. The geometry column is named "way" and for the osm_id 28414267 it contains:
0103000020E61000000100000016000000F988F3CBBB012A40ECEB0AC73DCD4B40B24CBF44BC012A400F046D173FCD4B40015B142CC4012A40399787F13FCD4B40F8CDB348C9012A4050357A3540CD4B407F750B13FC012A400E6EC6C441CD4B405BE4E83B09022A40263ACB2C42CD4B40DB3E9AA03C022A4060F01FC143CD4B406DECC84741022A4001E8E6D143CD4B403BAC70CB47022A409C22765C43CD4B40F107A8154B022A408A5B60EA42CD4B40B46DBD4B4E022A405BF1683E42CD4B4048BD4CB967022A404015376E31CD4B40A5CD829A6B022A409BDC39DE2ECD4B40D0807A336A022A401E79D6242ECD4B409EFB613A63022A4095DD825B2DCD4B406BC1E677F5012A40FA3D569522CD4B4063EFC517ED012A40FA3D569522CD4B40E92D7997E6012A407D1C72D822CD4B4057804AF0E1012A40F9C1548E24CD4B40DD8431D8C3012A40BF93BB7438CD4B40A977A7F1C1012A406B3304B639CD4B40F988F3CBBB012A40ECEB0AC73DCD4B40
We converted it to text and it contains exactly what I got with OGR: 22 nodes, no nested geometries.
EDIT 2: The above hexadecimal data as text:
POLYGON((13.0033859 55.6034478,13.0033895 55.6034879,13.0034498 55.6035139,13.0034888 55.603522,13.0038763 55.6035696,13.0039767 55.603582,13.0043688 55.6036302,13.0044043 55.6036322,13.004454 55.6036182,13.0044791 55.6036046,13.0045036 55.6035841,13.0046976 55.603071,13.0047272 55.6029928,13.0047165 55.6029707,13.0046633 55.6029467,13.0038259 55.6026179,13.003762 55.6026179,13.0037124 55.6026259,13.0036769 55.6026781,13.0034473 55.6032854,13.0034328 55.6033237,13.0033859 55.6034478))
I'm too lazy to check all of them, but the eleventh node (13.0045036 55.6035841
) matched the first node on OpenStreetMap.
MULTIPOLYGON
instead of justPOLYGON
if it was one.