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

fix: sharemap popup not displayed #1904

Merged
merged 2 commits into from
Nov 24, 2023
Merged

Conversation

steff-o
Copy link
Contributor

@steff-o steff-o commented Nov 23, 2023

Fixes #1900

Moved the rendering of the popup to the featuresloadend event of the source as the layer event postrender seems to be fired before features have been fetched from the source. Or possibly fired several times where the first is in a useless extent that does not load any features. This is probably due to a change in open layers.

As a bonus it fixes a bug in fetureInfo.showFeatureInfo that threw an exception when only one feature was sent. Previous implementation of sharemap did not suffer from this as the postrender event caller swallowed the exception and the functionality that was cut short due to the exception was zooming to the feature, which no one was missing as sharemap always includes center and zoom in the links so the map was already panned to the desired extent.

Bonus 2: It is now possible to actually zoom to the extent of the feature instead of the sharemap center and zoom by creating a link that omits center and zoom.

@johnnyblasta
Copy link
Collaborator

Tested and works for a WFS layer, but not GEOJSON for which it also worked previously.

@steff-o
Copy link
Contributor Author

steff-o commented Nov 23, 2023

New attempt. Made other layers emit the featuresloadend event. Also support for the (undocumented) static GeoJson type, which is impossible to attach to before the event is emitted (so it doesn't emit it).

Maybe another event should be more general, but it seems hard to avoid a race condition at startup using the various render events on both layers and map as they may be triggered several times before any features actually has been loaded which makes it hard to determine when to stop waiting.

Copy link
Collaborator

@johnnyblasta johnnyblasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with WFS and GEOJSON and it works, saw that AGS Feature should be supported, but I haven't the means to test that.

@jokd
Copy link
Contributor

jokd commented Nov 24, 2023

Looks good and making the behaviour more customizable is in line with #1899

@jokd jokd merged commit fb574fe into origo-map:master Nov 24, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sharemap with wfs no longer opens overlay or infowindow
3 participants