-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: add text/html support for geoserver #1955
Conversation
…ture other vendors are to be supported
|
Thanks to feedback from @johnnyblasta I've a local edit that handles Geoserver's default ftl template. A simple This illustrates my sudden doubts (about adding this functionality to the project):
The proper solution I see is that the user gets to create their own "htmlHandler" js module but that seems unprecedented. Is this something that should remain in the forks that need it? |
Yes, there seems to be a problem to find a solution for all possible cases, but it may suffice to find solution for some standard or simple cases. |
Is it always necessary to have a htmlSepartor? |
Cheers for the feedback. Showing the featureinfo result as it "wants" to be shown precludes cycling though individual features in an iw or overlay and seeing the selection switch to match, but it reasonably could be an option I suppose. I'll see what I can do. |
What I've done now follows our discussion yesterday: since it seems practically impossible to find a function that can handle many different htmls (because the htmls can be infinitely varied) we must provide a mechanism for supplying Origo with a handler function. featureinfo.js now has a If no such function is provided there is a pre-provided function that will, if no A controversial bit might be what isn't user customizable, namely how the html is (re)constructed: // case no htmlSeparator prop: show same dot geometry for all hits
// and put the documentElement of the response within <html>
if (!layer.get('htmlSeparator')) {
feature = featureCollection[0];
htmlfeat = `<html> ${element.documentElement.outerHTML} </html>`;
} else {
feature = featureCollection[index];
htmlfeat = `<html> ${htmlDOM.head.outerHTML} <body> ${element.outerHTML} </body> </html>`;
} One can only stray so much from the pre-configured function, so the query here is if the entire |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested with both table and bulleted list and works fine.
The table version doesn't presents well in the overlay, since it is a bit horizontal challenged, but what to do.
You could attempt to write a fitting handler function :) Thanks for the review, I will merge and create suitable documentation. |
Aims to fix #259 for
QGIS serverand Geoserver (see the second comment: support is only for Geoserver now)It employs the possible
type
property of sources in a similar way as print-resize.js (there is aserverType
prop of ol/source/wms but it has to do with hiDPI). I like this manual and unambiguous way of specifying a server vendor, it can probably be of use in further places.The nature of
text/html
as opposed to a featureCollection means that Origo needs to know where a feature ends and where one starts (for the carousel or multiple features in infowindow) and different vendors have different default templates (and perhaps customizability - ArcGIS Server and Geoserver have customizable templates, I haven't found anything definitive on QGIS server) and as such need to be handled differently. If customized things should not break but that depends on how they are customized.This PR introduces a
htmlseparator
layer prop that takes precedence if provided and means what html tag to split features via. If not provided it uses defaults for QGIS server and Geoserver.The reason ArcGIS Server is left out in the cold with this draft is because its default template, the blue and white horizontal table, gets very wide and breaks the carousel (which doesn't and probably shouldn't provide a scrollbar)
(I also rewrote the function to await syntax because why return a promise chain if no one is forcing you. It did not make the linter unhappy)
The PR sets a new attribute on each feature and on the layer and a new info template that returns the contents of this attribute.