[mapserver-users] Mapserver shows all nodes on a GeometryCollection
Eichner, Andreas - SID
Andreas.Eichner at sid.sachsen.de
Wed May 14 01:50:49 PDT 2014
You should take a look at the second column or rewrite the query as
SELECT
St_AsText( St_CollectionExtract( geom, 1 )) AS geom,
element_type
FROM
v_elements;
But the whole query doesn't make much sense in your case as don't have any real geometry collections. It doesn't filter your data but return an empty geometry and MapServer will effectively drop those lines. This isn't very efficient, so you should probably use something like
SELECT
St_AsText( geom ) AS geom,
FROM
v_elements
WHERE
GeometryType( geom ) = 'POINT'
AND
element_type = 'Voorziening';
However, the real problem is that the rendering engine implicitly converts the geometry to something useful for the current layer type. See http://mapserver.org/mapfile/layer.html regarding the layer's TYPE. So setting TYPE=point doesn't filter out lines and polygons - it converts them. But since points cannot be converted to lines or polygons, MapServer will skip them when TYPE=line, effectively filtering your data. Because of this implicit conversion you usually need to define a layer for each type. A very shortened version might look something like (assuming your primary key of the v_elements table is 'ID' and SRID -1):
LAYER
NAME "elements_voorziening_point"
TYPE POINT
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "host=yourhostname dbname=yourdatabasename user=yourdbusername
password=yourdbpassword port=yourpgport"
DATA "geom FROM v_elements USING UNIQUE id USING SRID -1"
FILTER "GeometryType( geom ) = 'POINT' AND element_type = 'Voorziening'"
CLASS
...
END
END
HTH
> -----Ursprüngliche Nachricht-----
> Von: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-
> bounces at lists.osgeo.org] Im Auftrag von drobins
> Gesendet: Dienstag, 13. Mai 2014 15:52
> An: mapserver-users at lists.osgeo.org
> Betreff: Re: [mapserver-users] Mapserver shows all nodes on a
> GeometryCollection
>
> Hi Jukka,
>
> the queries don't show what they're supposed to show, they show more
> information than requested.
> I'm adding a few screenshots with the 3 different queries, each showing
> lines and points
>
> <http://osgeo-org.1560.x6.nabble.com/file/n5140004/moz-screenshot-14.png>
> <http://osgeo-org.1560.x6.nabble.com/file/n5140004/moz-screenshot-15.png>
> <http://osgeo-org.1560.x6.nabble.com/file/n5140004/moz-screenshot-16.png>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/Re-
> Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5138525p5140004.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list