Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify on WFS point and line layers not returning results #601

Closed
brentfraser opened this issue Aug 26, 2020 · 3 comments · Fixed by #648
Closed

Identify on WFS point and line layers not returning results #601

brentfraser opened this issue Aug 26, 2020 · 3 comments · Fixed by #648
Labels
Milestone

Comments

@brentfraser
Copy link
Contributor

This may be a similar problem to #392. Identify makes a GetFeature request with a filter of

		<Filter xmlns="http://www.opengis.net/ogc">
			<Intersects>
				<PropertyName>the_geom</PropertyName>
				<Point xmlns="http://www.opengis.net/gml">
					<pos srsDimension="2">-8973326. 953823</pos>
				</Point>
			</Intersects>
		</Filter>

I don't know if intersecting a point with a point (or a line) is a valid spatial operation. We may need to construct a box around the query point and sent that with the request.

@brentfraser
Copy link
Contributor Author

brentfraser commented Aug 27, 2020

Spatial Query Operations (Identify, Select)

Protocol Feature Geometry Query By
Point (Identify)
Query By
Line (Select)
Query By
Polygon (Select)
WFS Point No: Bug (see fix below) No: N/A? Yes
Line No: Bug (see fix below Yes Yes
Polygon Yes Yes Yes
AGS vector Point Yes (BBOX #539) No: N/A? Yes
Line Yes (BBOX #539) Yes Yes
Polygon Yes Yes Yes
Vector file Point No: Bug No: N/A? No: Tab Bug
Line No: Bug No: Bug No: Tab Bug
Polygon Yes No: Bug No: Bug
Local (sketch) Point No: Bug No: Tab Bug No: Tab Bug
Line No: Bug No: Tab Bug No: Tab Bug
Polygon Yes No: Tab Bug No: Tab Bug

@brentfraser
Copy link
Contributor Author

The fix for the WFS problem is similar to the AGS fix. In components\map.js, just after line 326 insert code to make a small box around the point query geom:

        if (query.selection.length > 0) {
            const queryGeometry = query.selection[0].geometry;
            // Since WFS servers don't "intersect" a point with anything, we make a box
            // Make a 4 pixel (2 pixels each way) box around the point (and duplicate 
            //   the first point at the end)
            if (queryGeometry.type === 'Point'){
                const res = this.map.getView().getResolution() * 2;
                const pt = queryGeometry.coordinates;
                queryGeometry.type = 'Polygon'
                queryGeometry.coordinates = [[
                    [pt[0] + res, pt[1] + res],
                    [pt[0] + res, pt[1] - res],
                    [pt[0] - res, pt[1] - res],
                    [pt[0] - res, pt[1] + res],
                    [pt[0] + res, pt[1] + res]
                ]]
            }
            query.selection[0].geometry = queryGeometry;
        }

@brentfraser
Copy link
Contributor Author

As for the Vector file / Local data sources, it might be better to create a small box (like above), then in vectorLayerQuery use
src.forEachFeatureIntersectingExtent(box, (feature) =
to solve the Query By Point (identify).

But that won't solve the Query by Line or Polygon problem.

@klassenjs klassenjs added this to the 3.6.3 milestone Nov 23, 2020
@klassenjs klassenjs modified the milestones: 3.6.3, 3.7.0, 3.7.1 Feb 6, 2021
theduckylittle added a commit to theduckylittle/gm3 that referenced this issue May 22, 2021
- Refactores the pixel-tolerance code to be less inline with
   the query function.
- Changes the AGS query and the WFS query to both use
   pixel-tolerance as defined in the source. (AGS defaults to 2 as before)

Refs: geomoose#601
@theduckylittle theduckylittle linked a pull request May 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants