Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Lauftracking Tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Gatzert
Lauftracking Tool
Commits
ab14d5d4
Commit
ab14d5d4
authored
2 years ago
by
czm4871
Browse files
Options
Downloads
Patches
Plain Diff
Eingabe Marker durch Formularfeld hinzugefügt
parent
6df859a3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
function.js
+13
-12
13 additions, 12 deletions
function.js
function.zip
+0
-0
0 additions, 0 deletions
function.zip
index.html
+1
-1
1 addition, 1 deletion
index.html
with
14 additions
and
13 deletions
function.js
+
13
−
12
View file @
ab14d5d4
...
...
@@ -80,7 +80,7 @@ function addentry(){
var
map
=
L
.
map
(
'
map
'
).
setView
([
53.463
,
9.973
],
12
);
let
map
=
L
.
map
(
'
map
'
).
setView
([
53.463
,
9.973
],
12
);
L
.
tileLayer
(
'
https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
'
,
{
maxZoom
:
19
,
...
...
@@ -91,32 +91,33 @@ function addentry(){
//when the button gets clicked, the informations out of the input-field get displayed in the div "coordinates_output"
document
.
querySelector
(
"
#buttoncoordinates
"
).
onclick
=
function
()
{
//document.querySelector("#buttoncoordinates").onclick = function()
function
get_coordinates
()
{
//document.querySelector(".coordinates_output").innerHTML = document.querySelector("#coordinates").value;
//marker1 = L.marker([coordinates]).addTo(map);
//document.getElementById("case").innerHTML = marker1;
//console.log(L.marker([coord]));
let
coordinates
=
L
.
marker
([
document
.
querySelector
(
"
#
coordinates
"
).
value
])
;
let
marker1
=
coordinates
.
addTo
(
map
);
//console.log(L.marker([coord
inates
]));
//let coord = document.getElementById("coordinates").value;
let
coordinates
=
document
.
getElementById
(
"
coordinates
"
).
value
;
let
coordinates_sep
=
coordinates
.
split
(
"
,
"
);
let
marker1
=
L
.
marker
(
coordinates_sep
).
addTo
(
map
);
}
//let coordinate = document.querySelector("coordinates").value;
//marker1.addTo(map); ---> wie kann ich eine Variable definieren,
//------------------------die auch außerhalb einer Funktion gilt?
var
coord1
=
"
53.468336, 9.960204
"
;
//
var coord1 = "53.468336, 9.960204";
//Marker get added
/*var marker1 = L.marker([53.468336, 9.960204]).addTo(map);
/*var koordinaten = ["53.468336", "9.960204"];
var marker1 = L.marker(koordinaten).addTo(map);
var marker2 = L.marker([53.459333, 10.017835]).addTo(map);
var marker3 = L.marker([53.444, 9.947]).addTo(map);
var marker4 = L.marker([53.452, 10.020]).addTo(map);*/
var
latlngs
=
Array
()
let
latlngs
=
Array
()
/*var latlngs = [
[53.453, 10.017],
[53.462, 9.883],
...
...
@@ -132,7 +133,7 @@ var coord1 = "53.468336, 9.960204";
//From documentation http://leafletjs.com/reference.html#polyline
// create a red polyline from an arrays of LatLng points
var
polyline
=
L
.
polyline
(
latlngs
,
{
color
:
'
red
'
}).
addTo
(
map
);
let
polyline
=
L
.
polyline
(
latlngs
,
{
color
:
'
red
'
}).
addTo
(
map
);
// zoom the map to the polyline
//map.fitBounds(polyline.getBounds());
...
...
This diff is collapsed.
Click to expand it.
function.zip
0 → 100644
+
0
−
0
View file @
ab14d5d4
File added
This diff is collapsed.
Click to expand it.
index.html
+
1
−
1
View file @
ab14d5d4
...
...
@@ -85,7 +85,7 @@
<div
class=
"section-container"
>
<form>
<input
type=
"text"
id=
"coordinates"
name=
"koordinaten"
placeholder=
"Gib hier deine Koordinaten ein"
>
<button
onclick=
""
id=
"buttoncoordinates"
type=
"button"
>
Koordinaten hinzufügen
</button>
<button
onclick=
"
get_coordinates()
"
id=
"buttoncoordinates"
type=
"button"
>
Koordinaten hinzufügen
</button>
</form>
<div
class=
"coordinates_output"
>
</div>
...
...
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