Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hi Andreas, I took your layer filter and tried that. Yours gave me an error, so I adjusted it to this: FILTER (GeometryType( geom ) = 'POINT' AND element_type = 'Voorziening') This fixed the problem! The layer is only showing the points now that are supposed to be shown and no longer shows the nodes from the lines and polygons! Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Re-Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5138525p5141149.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hi all, I figured I'd post it here as well as a new thread was opened earlier: See: http://osgeo-org.1560.x6.nabble.com/Re-Mapserver-shows-all-nodes-on-a-GeometryCollection-td5138525.html Hi Andreas, I took your layer filter and tried that. Yours gave me an error, so I adjusted it to this: FILTER (GeometryType( geom ) = 'POINT' AND element_type = 'Voorziening') This fixed the problem! The layer is only showing the points now that are supposed to be shown and no longer shows the nodes from the lines and polygons! Thanks! -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5141150.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
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-boun...@lists.osgeo.org [mailto:mapserver-users- boun...@lists.osgeo.org] Im Auftrag von drobins Gesendet: Dienstag, 13. Mai 2014 15:52 An: mapserver-users@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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hi Jörg, I did some research: the query select st_astext (ST_CollectionExtract ('POINT (0 0)', 3)); returns Polygon empty select st_astext (ST_CollectionExtract ('POINT (0 0)', 2)) returns Empty String Line select st_astext (ST_CollectionExtract ('POINT (0 0)', 1)) returns POINT (0,0) So far so good However, the query's select ST_AsText (geom), ST_CollectionExtract (geom, 1) select ST_AsText (geom), ST_CollectionExtract (geom, 2) select ST_AsText (geom), ST_CollectionExtract (geom, 3) returns all the same results POINT (137237.8268 431571.3851) LINE STRING (136944.60681 431208.56879,136987.41809 431205.51391) POLYGON ((138960.87229 438028.94701,138954.04612 438015.9692,138951.5854 438017.2392,138953.60948 438022.39861,138962.5392 438042.0042,138973.61211 438066.17399,138977.8189 438064.50711,138970.0799 438048.71139,138960.872 (...) Any of this rings a bell perhaps? -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5138520.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hi, Could you possibly show us the whole LAYER from your mapfile and one GeometryCollection as WKT? Perhaps someone gets interested in making some trials. Do you feel that there is something odd with your sample SQL? For me it looks like your GeometryCollection has one point, one linestring and one polygon and your query correctly finds them all one by one. -Jukka Rahkonen- drobins wrote: Hi Jörg, I did some research: the query select st_astext (ST_CollectionExtract ('POINT (0 0)', 3)); returns Polygon empty select st_astext (ST_CollectionExtract ('POINT (0 0)', 2)) returns Empty String Line select st_astext (ST_CollectionExtract ('POINT (0 0)', 1)) returns POINT (0,0) So far so good However, the query's select ST_AsText (geom), ST_CollectionExtract (geom, 1) select ST_AsText (geom), ST_CollectionExtract (geom, 2) select ST_AsText (geom), ST_CollectionExtract (geom, 3) returns all the same results POINT (137237.8268 431571.3851) LINE STRING (136944.60681 431208.56879,136987.41809 431205.51391) POLYGON ((138960.87229 438028.94701,138954.04612 438015.9692,138951.5854 438017.2392,138953.60948 438022.39861,138962.5392 438042.0042,138973.61211 438066.17399,138977.8189 438064.50711,138970.0799 438048.71139,138960.872 (...) Any of this rings a bell perhaps? -- View this message in context: http://osgeo- org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection- tp5135064p5138520.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hi Jörg, I have lines, points and polygons stored in my table. The table has various columns, one which I filter the elements on (element_type). One of those elements is a Voorziening, but Voorziening has points, lines and polygon objects. My LINE layer works fine. It only displays the lines on filter element_type = Voorziening My POLYGON layer works fine. It only displays the polygons on filter element_type = Voorziening However, my POINT layer does display the specific point objects, but also all nodes on the line/polygon objects with element_type = Voorziening When I set DEBUG 5 on the point layer and execute that query from the log file into pgadmin, it only displays one result. One thing I tried last night is to use 2 filters; one for the main element_type and another that described the object - objective. I was able to filter out most of these extra points that way. Unfortunately, objective also has point and line objects with the same name, so in a few cases I still see the extra points. Added the mapfile via Upload a file, hope it adds correctly The layer that's problematic is called NAME elements_voorzieningpoint -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5135307.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
moin, I don't see anything, that could cause the problem. Your architecture is hard to understand without knowing the whole structure, viewing the reuslts and access to the database. In my mapserver and postgis trainings I'm always telling the participants you *can* mix geometry-types and in in most cases it works So I would suggest to break it down to little pieces and rebuild your WMS step by step: - create a wms with only the problematic layer - use the shape-file as data source - import the shape-file to an new table with only the point-geometries - it's not a lot of fun, but at any step the behaviour will switch from right to wrong (or wrong to right) and at this point point it will be much easier to find the problem. Certainly you may post to the list again and I am sure many of us want to know the solution. So when it works don't forget the list :) Jörg Am 16.04.2014 08:40, schrieb drobins: Hi Jörg, I have lines, points and polygons stored in my table. The table has various columns, one which I filter the elements on (element_type). One of those elements is a Voorziening, but Voorziening has points, lines and polygon objects. My LINE layer works fine. It only displays the lines on filter element_type = Voorziening My POLYGON layer works fine. It only displays the polygons on filter element_type = Voorziening However, my POINT layer does display the specific point objects, but also all nodes on the line/polygon objects with element_type = Voorziening When I set DEBUG 5 on the point layer and execute that query from the log file into pgadmin, it only displays one result. One thing I tried last night is to use 2 filters; one for the main element_type and another that described the object - objective. I was able to filter out most of these extra points that way. Unfortunately, objective also has point and line objects with the same name, so in a few cases I still see the extra points. Added the mapfile via Upload a file, hope it adds correctly The layer that's problematic is called NAME elements_voorzieningpoint -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5135307.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
I'll look a bit deeper into it when I have a bit more time available and try it the way you suggest by building the WMS from scratch. I'm not sure if I can use the shape file as source, because the geometry is linked to a variety of postgres tables to supply the geometry with administrative data. If I happen to find a solution I'll be sure to post it here! Thanks for your time and help thusfar! Daniel -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5135348.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hello, I am loading a point LAYER in mapserver which requests data from a geometrycollection table from my PostGIS database. The table has point, line and polygon objects. Whenever I enable my point layer, it also displays all nodes from the lines and polygons. When loading the same table into QGIS, these nodes don't show. I am using Mapserver version 6.4.1 and PostgreSQL version 9.1.12 -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hello, correct. MapServer does not check the geometry-type, you can visualize a polygon-layer as points showing the vertices for example. If you only want to show the points of your geometry-colletcion, you have to select the points of your geometry only: select ST_CollectionExtract(geom, 1) as geom ... Regards, Jörg Am 15.04.2014 08:56, schrieb drobins: Hello, I am loading a point LAYER in mapserver which requests data from a geometrycollection table from my PostGIS database. The table has point, line and polygon objects. Whenever I enable my point layer, it also displays all nodes from the lines and polygons. When loading the same table into QGIS, these nodes don't show. I am using Mapserver version 6.4.1 and PostgreSQL version 9.1.12 -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
-- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5135112.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Hello Jörg, I have tried to get the correct # of points in my query but it keeps returning me more than I have. There are 293 points in my table, yet the query shows 779 which also appear on my map. The 293 are the ones I want, the others seem to be the nodes from the polygons and/or lines. Is there a way to exclude these? -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5135113.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Am 15.04.2014 13:28, schrieb drobins: Hello Jörg, I have tried to get the correct # of points in my query but it keeps returning me more than I have. There are 293 points in my table, yet the query shows 779 which also appear on my map. The 293 are the ones I want, the others seem to be the nodes from the polygons and/or lines. Is there a way to exclude these? I am not sure what you are doing, in select ST_CollectionExtract(geom, 1) as geom ... the '1' is for poin-geomtries, (2 - lines 3 - polygons) Jörg ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
Let my add a screenshot from my problem http://osgeo-org.1560.x6.nabble.com/file/n5135121/error.png I have 2 layers enabled in my map: a point layer and a line layer. The line layer works correct. The point layer shows points that are not in my source data (shape file which I inserted into postgis). At every end of a line, somehow a point is added, which isn't in my source data. When I load the same area in QGIS, these points do not appear. I hope this makes my problem more clear. Thanks -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5135121.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver shows all nodes on a GeometryCollection
hm.. - lines and points are stored in the same table you said? - do you get the correct result if you do the data-query in postgis / pgadmin? - what happens if you use your point-shape-file as data-source in mapserver? - if you only request the line-layer the points don't appear? - could you post the whole mapfile? Jörg Am 15.04.2014 13:50, schrieb drobins: Let my add a screenshot from my problem http://osgeo-org.1560.x6.nabble.com/file/n5135121/error.png I have 2 layers enabled in my map: a point layer and a line layer. The line layer works correct. The point layer shows points that are not in my source data (shape file which I inserted into postgis). At every end of a line, somehow a point is added, which isn't in my source data. When I load the same area in QGIS, these points do not appear. I hope this makes my problem more clear. Thanks -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapserver-shows-all-nodes-on-a-GeometryCollection-tp5135064p5135121.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users