-
Notifications
You must be signed in to change notification settings - Fork 325
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
gluon-config-mode-geo-location-osm: OpenStreetMap-based location picker #1515
Conversation
50e6502
to
a2913e1
Compare
a2913e1
to
a749516
Compare
docs/user/site.rst
Outdated
@@ -407,6 +407,13 @@ config_mode \: optional | |||
package. Set *geo_location.show_altitude* to *true* if you want the altitude | |||
field to be visible. | |||
|
|||
The *geo_location.osm* section is only relevant when the *gluoin-config-mode-geo-location-osm* |
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.
gluoin-config-mode-geo-location-osm -> gluon-config-mode-geo-location-osm
@@ -0,0 +1,4 @@ | |||
need_number(in_site({'config_mode', 'geo_location', 'osm', 'center', 'lon'})) | |||
need_number(in_site({'config_mode', 'geo_location', 'osm', 'center', 'lat'})) |
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.
Maybe we can have default values like 0.0/0.0 to reduce site.conf parameters.
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.
Certainly not. This is a value that must be provided by each site, 0.0/0.0 simply doesn't make sense.
a749516
to
b0cc8cf
Compare
@@ -284,6 +284,12 @@ code { | |||
margin-bottom: 2em; | |||
} | |||
|
|||
.gluon-osm-map { | |||
width: 100%; | |||
height: 40em; |
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.
40em seems to much maybe 25 is better the map looks nicer.
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.
The width of the main content scales between 40em and 60em (depending on the window width), meaning that with a height of 40em the map is square in narrow windows, and has a 3:2 aspect ratio in wide windows. This is already close to the usual widescreen display aspect ratio of 16:10.
Given that the relevant areas for sites should be circular on average, a square seems like the best approximation to me. Further decreasing the height would make the map less square, so we should either increase the height, or keep the current value...
b0cc8cf
to
05d816c
Compare
i think it's a nice solution. |
if osm then | ||
map = s:option(osm.MapValue, "map", osm.options(lon, lat)) | ||
map:depends(share_location, true) | ||
end |
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.
It would be more clear if we put the 'share_location' checkbox below the map.
05d816c
to
18c1d7e
Compare
This would be an ideal basis for picking a domain, e.g. through boundary box overlays, like at https://darmstadt.freifunk.net/mitmachen/domains/. |
@NeoRaider There seems a bug in thins code. If I have "Advertise node position" checked and had already select a position on the map. After Pressing "Save & restart" the configmode will be just reload but not completed. Only after I have unchecked "Advertise node position" I can apply the formula. |
Hmm, I will look into this. |
14822d7
to
3bd2078
Compare
I fixed two issues in the code:
|
@NeoRaider I can confirm the bugfix. Now everything seems working as expected. |
docs/user/site.rst
Outdated
define the default center of the map when no position has been picked yet. The *zoom* level | ||
defaults to 12 in this case. *openlayers_url* allows to override the base URL of the | ||
*build/ol.js* and *css/ol.css* files (the default is | ||
``https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3``). |
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.
url can be update to https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.2.0/build/ol.js
that contains your upstream fixes.
Can be used for inserting Lua values into inline JS code.
…pass them through
The new code is shorter and uses more readable variable names. It does not depend on specifically named input fields anymore (allowing to use multiple maps on the same page), and only uses well-defined interfaces to trigger revalidation of input fields. The Map model class allows to add OSM maps to gluon-web forms.
gluon-config-mode-geo-location-osm extends the gluon-config-mode-geo-location with a location picker based on OpenStreetMaps. Based-on-patch-by: Jan-Tarek Butt <tarek@ring0.de>
3bd2078
to
a8d736a
Compare
worth noting: the URL in the example from site.rst does not work. That is just an example from alpha centauri, if you are mirroring the javascript in your own domain.
|
This PR contains the revised version of the OpenStreetMap-based location picker for the config mode (#1484).
Changes:
The one big remaining issue is that OpenLayers 5.1.3 does not work with XHTML (or HTML5 delivered with application/xhtml+xml Content-Type). This has been fixed in openlayers/openlayers#8524, so I hope the next OpenLayers release will just work.