[Mapguide-trac] [mapguide-trac] #2841: SELECTFEATURES (v4.0.0) shows no result when querying different geometries
MapGuide Open Source
trac_mapguide at osgeo.org
Thu Sep 16 02:47:08 PDT 2021
#2841: SELECTFEATURES (v4.0.0) shows no result when querying different geometries
-----------------------+--------------------
Reporter: gBecker | Owner: (none)
Type: defect | Status: new
Priority: medium | Milestone:
Component: Web API | Version: 3.1.0
Severity: trivial | Keywords:
External ID: |
-----------------------+--------------------
I use a Postgres/Postgis view for labeling map objects. This view has a
geometry column that is either a point geometry or a linestring geometry.
To merge the different geometries from the original table into the view, I
use the COALESCE command:
{{{
COALESCE (l.point, l.line) AS geom
}}}
If I display this view in the AjaxViewer (preview via Maestro), then both
geometry types are displayed correctly as you can see in the picture
(please ignore the bad labeling of the line):
When I try to display the geometries in OpenLayers using the
"SELECTFEATURES" method, nothing is displayed because the request does not
return any result:
REQUEST:
{{{
http://localhost/mapguide4.0//mapagent/mapagent.fcgi?
OPERATION=SELECTFEATURES&
VERSION=4.0.0&
USERNAME=Anonymous&
LOCALE=en&
CLIENTAGENT=OpenLayers&
RESOURCEID=Library://Labels.FeatureSource&
CLASSNAME=public:mg_labels&
FORMAT=application/json&
CLEAN=1&
PRECISION=11&
FILTER=geom%20INTERSECTS%20GeomFromText(%27POLYGON((486475.17294845433%205781448.278972937,%20486475.17294845433%205781602.9279312715,%20486712.6364901211%205781602.9279312715,%20486712.6364901211%205781448.278972937,%20486475.17294845433%205781448.278972937))%27)%20AND%20thema%20=%20%27Lagebezeichnungen%27%20AND%20size%20%3C%206%20&
PROPERTIES=drehwinkel_grad%09horizontal%09size%09gruen%09blau%09vertikal%09rot%09text%09ogc_fid%09%09geom
}}}
RESULT:
{{{
{"type": "FeatureCollection", "features": []}
}}}
I then changed the view as follows so that it only contains one geometry
type:
{{{
l.line AS geom
}}}
I then reset the FeatureSource so that the changed schema is used. Now the
above request gives a correct result but of course only with the line
geometries:
{{{
{ "type": "FeatureCollection", "features": [{ "type": "Feature",
"geometry": { "type": "LineString", "coordinates": [[486603.93199999997,
5781511.19900000002],[486607.52000000002,
5781525.0839999998],[486608.01899999997, 5781527.61699999962],[486610.81,
5781550.62299999967]]}, "properties": {"drehwinkel_grad": 0,"horizontal":
"Left","size": 4,"gruen": 0,"blau": 0,"vertikal": "Baseline","rot":
0,"text": "Bromberger Straße","ogc_fid": 2013401}},{ "type": "Feature",
"geometry": { "type": "LineString", "coordinates": [[486603.93199999997,
5781511.19900000002],[486607.52000000002,
5781525.0839999998],[486608.01899999997, 5781527.61699999962],[486610.81,
5781550.62299999967]]}, "properties": {"drehwinkel_grad": 0,"horizontal":
"Left","size": 4,"gruen": 0,"blau": 0,"vertikal": "Baseline","rot":
0,"text": "Bromberger Straße","ogc_fid": 34677}}]}
}}}
Then I changed the line back to
{{{
COALESCE (l.point, l.line) AS geom
}}}
and without resetting the FeatureSource, execute the request again and get
the result that I originally wanted: point and line geometries together:
{{{
{ "type": "FeatureCollection", "features": [{ "type": "Feature",
"geometry": { "type": "Point", "coordinates": [486571.36200000002,
5781561.3200000003]}, "properties": {"drehwinkel_grad":
5.03328526119755,"horizontal": "Left","size": 4,"gruen": 0,"blau":
0,"vertikal": "Baseline","rot": 0,"text": "Kösliner Straße","ogc_fid":
2010507}},{ "type": "Feature", "geometry": { "type": "LineString",
"coordinates": [[486603.93199999997, ....
}}}
It seems that the problem has something to do with the loaded schema. As I
said before, everything is displayed correctly when called via the Ajax
viewer, but not when you use the "SELECTFEATURES" method.
And it also has something to do with the spatial filter in the request. If
I remove the spatial filter from the query, I get both geometry types
returned.
--
Ticket URL: <https://trac.osgeo.org/mapguide/ticket/2841>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals
More information about the mapguide-trac
mailing list