Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ffho-packages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Freifunk Hochstift
ffho-packages
Commits
1c55727f
Commit
1c55727f
authored
9 years ago
by
Karsten Böddeker
Browse files
Options
Downloads
Patches
Plain Diff
ffho-site-auto-select: fix incompatible formate
pointwithinshape needs {{x=..,y=..}...}
parent
c3535958
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ffho/ffho-site-auto-select/files/lib/gluon/upgrade/003-site-auto-select
+12
-3
12 additions, 3 deletions
...-auto-select/files/lib/gluon/upgrade/003-site-auto-select
with
12 additions
and
3 deletions
ffho/ffho-site-auto-select/files/lib/gluon/upgrade/003-site-auto-select
+
12
−
3
View file @
1c55727f
...
...
@@ -5,7 +5,7 @@ local json = require 'luci.json'
local
tools
=
require
'gluon.site_generate'
local
shape
=
require
'gluon.pointwithinshape'
local
geo_default_site
=
"ffho_
yho
"
local
geo_default_site
=
"ffho_
error
"
function
get_config
(
file
)
local
f
=
io.open
(
file
)
...
...
@@ -44,8 +44,17 @@ function get_site_by_geo(latitude, longitude)
local
sites
=
tools
.
get_config
(
'/lib/gluon/site-select/geo.json'
).
features
for
_
,
site
in
ipairs
(
sites
)
do
if
site
.
geometry
and
site
.
geometry
.
coordinates
and
shape
.
PointWithinShape
(
site
.
geometry
.
coordinates
,
latitude
,
longitude
)
then
return
site
.
properties
.
site_code
if
site
.
geometry
and
site
.
geometry
.
coordinates
then
local
tmp1
=
{}
for
_
,
val
in
ipairs
(
site
.
geometry
.
coordinates
[
1
])
do
local
tmp2
=
{}
tmp2
.
x
=
val
[
2
]
tmp2
.
y
=
val
[
1
]
table.insert
(
tmp1
,
tmp2
)
end
if
shape
.
PointWithinShape
(
tmp1
,
tonumber
(
latitude
),
tonumber
(
longitude
))
then
return
site
.
properties
.
site_code
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment