Closed pvgenuchten closed 5 years ago
jinja2 indeed has a filter for this
{{ft.prop|urlize}}
Links in HTML work fine now! You folks still want to add thumbnail images? Think there is a simple way and an advanced method.
Simple: just look at the extension of the attr URL, if it ends with .jpeg|.jpg|.png|.gif
etc. The RCE WFS @pvgenuchten mentioned above has an interesting layer "castles" (Dutch kastelen
). E.g. Castle Kernhem in Ede:
(hmm more of a Mansion I would say).
The more advanced way would be to sniff Content-Type for each URL attribute and based on that display the image (or maybe other content like Audio or Video).
Would go for the simple way first using a Python regexp
(something like \.(?i:jpg|gif|png|bmp)
) for all valid Image extensions. Would make a great demo!
I've added this castles
layer to the demo services, but maybe also a nice layer for the default config. Shall I add there as well? As it contains links to HTML and images.
Sure. Having said this, should we break out our sample configs? i.e.:
examples/
directory with various configurations for users to see how different providers are setupSure. Having said this, should we break out our sample configs? i.e.:
- have a really simple configuration to get a user up and running as quickly as possible. I would propose a single collection which requires as little provider dependencies as possible
- have an
examples/
directory with various configurations for users to see how different providers are setup
Yes good idea, van you open an issue for that?
As a first time user back then I found 3 hurdles:
1) missing deps needed for default config (see above) 2) needing to generate openapi YAML (could this not be done within pygeoapi startup?) 3) use of (the two) environment variables
Related to 1) also I propose to split off Provider deps from requirements-dev.txt
into a requirements-providers.txt
. 2) and 3) are for later, I can add issue for that if needed. There is this 5 (10?) minute rule for FOSS software: the time to get up and running or abandon.
Thanks @justb4, I will open a separate ticket.
In terms of ease of install, does the install documentation help? Once we get documentation up and running would this help?
Yes (with docs), though still I the number of install/run steps could be more compact (requirements-dev.txt
not needed for minimal install , so for a developer section and above 2)+3)). Maybe also a pypi
install.
IMO the way to go is to add a Jinja2 macro replacing urlize
. This macro will analyze the URL. If it ends with an image regexp like \.(?i:jpg|gif|png|bmp)
it will try to render an HTML <img>
element, in all other cases a regular <a>
link element.
Can take this up, and PR next, made a Jinja2 macro that gives results like this (image size is macro param):
if a feature property contains a link (starts with 'http') it should be displayed as a clickable hyperlink, i hope it can be implemented as filter in the template language:
This can be extended to convert links that end in .gif/.svg/.jpg/.png to
A test service (as wfs2 source) could be this one http://services.rce.geovoorziening.nl/landschapsatlas/wfs?request=GetCapabilities&service=WFS (various featuretypes have image references; kastelen, hunebedden, etc)