Google maps pins import from .txt
up vote
-2
down vote
favorite
var gmarkers1 = ;
var markers1 = ;
var infowindow = new google.maps.InfoWindow({
content: ''
});
markers1 = [
['0', 'Title', 52.4357808, 4.991315699999973, 'car'],
['1', 'Title', 52.4357808, 4.981315699999973, 'third'],
['2', 'Title', 52.4555687, 5.039231599999994, 'car'],
['3', 'Title', 52.4555687, 5.029231599999994, 'second']
];
I found this script, how can I import data from .txt files into markers1
?
And second, how can I show my select on text with document.getElementById
?
I show only title, like this, if I choose "car" to show only the title:
<div id="map-canvas"></div>
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Please select category</option>
<option value="second">second</option>
<option value="car">car</option>
<option value="third">third</option>
</select>
full script here
Google Map Pins - Filter by category
javascript google-maps import maps pins
add a comment |
up vote
-2
down vote
favorite
var gmarkers1 = ;
var markers1 = ;
var infowindow = new google.maps.InfoWindow({
content: ''
});
markers1 = [
['0', 'Title', 52.4357808, 4.991315699999973, 'car'],
['1', 'Title', 52.4357808, 4.981315699999973, 'third'],
['2', 'Title', 52.4555687, 5.039231599999994, 'car'],
['3', 'Title', 52.4555687, 5.029231599999994, 'second']
];
I found this script, how can I import data from .txt files into markers1
?
And second, how can I show my select on text with document.getElementById
?
I show only title, like this, if I choose "car" to show only the title:
<div id="map-canvas"></div>
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Please select category</option>
<option value="second">second</option>
<option value="car">car</option>
<option value="third">third</option>
</select>
full script here
Google Map Pins - Filter by category
javascript google-maps import maps pins
2
Hi @Rackal, as a rule of thumb, you should provide "Research Effort" when asking in StackOverflow. Also, I know writing in a second language is hard, I am not a native english speaker either, however I'm sure that if you take your time you could came out with a better question.
– Luis Miguel Mejía Suárez
Nov 10 at 21:42
Thanks for the answer, I did my research on stacks but I did not find anything relevant. Unfortunately it does not let me put all the code for this and put the link. My question is simple. I want Markers1 = to read the data from txt files. Also, when I choose a category, I want to display the map results on a <div>. I hope you understand me. Thanks.
– Rackal
Nov 10 at 23:26
I'm not a front-end developer so I can't help you with the second question, but probably you could just repaint the contents of thediv
when you choose a category (attaching an action to the event of the radio button menu). For the first one, maybe this can help? - as long as the file is in a server you could load it, or even better make a simple api that returns the data as a JSON, now if the file is local you would need the user to load it first.
– Luis Miguel Mejía Suárez
Nov 11 at 16:56
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
var gmarkers1 = ;
var markers1 = ;
var infowindow = new google.maps.InfoWindow({
content: ''
});
markers1 = [
['0', 'Title', 52.4357808, 4.991315699999973, 'car'],
['1', 'Title', 52.4357808, 4.981315699999973, 'third'],
['2', 'Title', 52.4555687, 5.039231599999994, 'car'],
['3', 'Title', 52.4555687, 5.029231599999994, 'second']
];
I found this script, how can I import data from .txt files into markers1
?
And second, how can I show my select on text with document.getElementById
?
I show only title, like this, if I choose "car" to show only the title:
<div id="map-canvas"></div>
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Please select category</option>
<option value="second">second</option>
<option value="car">car</option>
<option value="third">third</option>
</select>
full script here
Google Map Pins - Filter by category
javascript google-maps import maps pins
var gmarkers1 = ;
var markers1 = ;
var infowindow = new google.maps.InfoWindow({
content: ''
});
markers1 = [
['0', 'Title', 52.4357808, 4.991315699999973, 'car'],
['1', 'Title', 52.4357808, 4.981315699999973, 'third'],
['2', 'Title', 52.4555687, 5.039231599999994, 'car'],
['3', 'Title', 52.4555687, 5.029231599999994, 'second']
];
I found this script, how can I import data from .txt files into markers1
?
And second, how can I show my select on text with document.getElementById
?
I show only title, like this, if I choose "car" to show only the title:
<div id="map-canvas"></div>
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Please select category</option>
<option value="second">second</option>
<option value="car">car</option>
<option value="third">third</option>
</select>
full script here
Google Map Pins - Filter by category
var gmarkers1 = ;
var markers1 = ;
var infowindow = new google.maps.InfoWindow({
content: ''
});
markers1 = [
['0', 'Title', 52.4357808, 4.991315699999973, 'car'],
['1', 'Title', 52.4357808, 4.981315699999973, 'third'],
['2', 'Title', 52.4555687, 5.039231599999994, 'car'],
['3', 'Title', 52.4555687, 5.029231599999994, 'second']
];
var gmarkers1 = ;
var markers1 = ;
var infowindow = new google.maps.InfoWindow({
content: ''
});
markers1 = [
['0', 'Title', 52.4357808, 4.991315699999973, 'car'],
['1', 'Title', 52.4357808, 4.981315699999973, 'third'],
['2', 'Title', 52.4555687, 5.039231599999994, 'car'],
['3', 'Title', 52.4555687, 5.029231599999994, 'second']
];
<div id="map-canvas"></div>
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Please select category</option>
<option value="second">second</option>
<option value="car">car</option>
<option value="third">third</option>
</select>
<div id="map-canvas"></div>
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Please select category</option>
<option value="second">second</option>
<option value="car">car</option>
<option value="third">third</option>
</select>
javascript google-maps import maps pins
javascript google-maps import maps pins
edited Nov 10 at 22:06
rm-
4,13922351
4,13922351
asked Nov 10 at 17:58
Rackal
12
12
2
Hi @Rackal, as a rule of thumb, you should provide "Research Effort" when asking in StackOverflow. Also, I know writing in a second language is hard, I am not a native english speaker either, however I'm sure that if you take your time you could came out with a better question.
– Luis Miguel Mejía Suárez
Nov 10 at 21:42
Thanks for the answer, I did my research on stacks but I did not find anything relevant. Unfortunately it does not let me put all the code for this and put the link. My question is simple. I want Markers1 = to read the data from txt files. Also, when I choose a category, I want to display the map results on a <div>. I hope you understand me. Thanks.
– Rackal
Nov 10 at 23:26
I'm not a front-end developer so I can't help you with the second question, but probably you could just repaint the contents of thediv
when you choose a category (attaching an action to the event of the radio button menu). For the first one, maybe this can help? - as long as the file is in a server you could load it, or even better make a simple api that returns the data as a JSON, now if the file is local you would need the user to load it first.
– Luis Miguel Mejía Suárez
Nov 11 at 16:56
add a comment |
2
Hi @Rackal, as a rule of thumb, you should provide "Research Effort" when asking in StackOverflow. Also, I know writing in a second language is hard, I am not a native english speaker either, however I'm sure that if you take your time you could came out with a better question.
– Luis Miguel Mejía Suárez
Nov 10 at 21:42
Thanks for the answer, I did my research on stacks but I did not find anything relevant. Unfortunately it does not let me put all the code for this and put the link. My question is simple. I want Markers1 = to read the data from txt files. Also, when I choose a category, I want to display the map results on a <div>. I hope you understand me. Thanks.
– Rackal
Nov 10 at 23:26
I'm not a front-end developer so I can't help you with the second question, but probably you could just repaint the contents of thediv
when you choose a category (attaching an action to the event of the radio button menu). For the first one, maybe this can help? - as long as the file is in a server you could load it, or even better make a simple api that returns the data as a JSON, now if the file is local you would need the user to load it first.
– Luis Miguel Mejía Suárez
Nov 11 at 16:56
2
2
Hi @Rackal, as a rule of thumb, you should provide "Research Effort" when asking in StackOverflow. Also, I know writing in a second language is hard, I am not a native english speaker either, however I'm sure that if you take your time you could came out with a better question.
– Luis Miguel Mejía Suárez
Nov 10 at 21:42
Hi @Rackal, as a rule of thumb, you should provide "Research Effort" when asking in StackOverflow. Also, I know writing in a second language is hard, I am not a native english speaker either, however I'm sure that if you take your time you could came out with a better question.
– Luis Miguel Mejía Suárez
Nov 10 at 21:42
Thanks for the answer, I did my research on stacks but I did not find anything relevant. Unfortunately it does not let me put all the code for this and put the link. My question is simple. I want Markers1 = to read the data from txt files. Also, when I choose a category, I want to display the map results on a <div>. I hope you understand me. Thanks.
– Rackal
Nov 10 at 23:26
Thanks for the answer, I did my research on stacks but I did not find anything relevant. Unfortunately it does not let me put all the code for this and put the link. My question is simple. I want Markers1 = to read the data from txt files. Also, when I choose a category, I want to display the map results on a <div>. I hope you understand me. Thanks.
– Rackal
Nov 10 at 23:26
I'm not a front-end developer so I can't help you with the second question, but probably you could just repaint the contents of the
div
when you choose a category (attaching an action to the event of the radio button menu). For the first one, maybe this can help? - as long as the file is in a server you could load it, or even better make a simple api that returns the data as a JSON, now if the file is local you would need the user to load it first.– Luis Miguel Mejía Suárez
Nov 11 at 16:56
I'm not a front-end developer so I can't help you with the second question, but probably you could just repaint the contents of the
div
when you choose a category (attaching an action to the event of the radio button menu). For the first one, maybe this can help? - as long as the file is in a server you could load it, or even better make a simple api that returns the data as a JSON, now if the file is local you would need the user to load it first.– Luis Miguel Mejía Suárez
Nov 11 at 16:56
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I have tried the following code
filterMarkers = function (category) {
for (i = 0; i < markers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// Categories don't match
else {
marker.setVisible(false);
}
document.getElementById("demo").innerHTML = "You selected: " + marker;
}
<p id="demo"></p>
but it throws me [object]
To read from txt I can not convey it in some way. The file will be in a file server
Thank you for your time!
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I have tried the following code
filterMarkers = function (category) {
for (i = 0; i < markers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// Categories don't match
else {
marker.setVisible(false);
}
document.getElementById("demo").innerHTML = "You selected: " + marker;
}
<p id="demo"></p>
but it throws me [object]
To read from txt I can not convey it in some way. The file will be in a file server
Thank you for your time!
add a comment |
up vote
0
down vote
I have tried the following code
filterMarkers = function (category) {
for (i = 0; i < markers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// Categories don't match
else {
marker.setVisible(false);
}
document.getElementById("demo").innerHTML = "You selected: " + marker;
}
<p id="demo"></p>
but it throws me [object]
To read from txt I can not convey it in some way. The file will be in a file server
Thank you for your time!
add a comment |
up vote
0
down vote
up vote
0
down vote
I have tried the following code
filterMarkers = function (category) {
for (i = 0; i < markers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// Categories don't match
else {
marker.setVisible(false);
}
document.getElementById("demo").innerHTML = "You selected: " + marker;
}
<p id="demo"></p>
but it throws me [object]
To read from txt I can not convey it in some way. The file will be in a file server
Thank you for your time!
I have tried the following code
filterMarkers = function (category) {
for (i = 0; i < markers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// Categories don't match
else {
marker.setVisible(false);
}
document.getElementById("demo").innerHTML = "You selected: " + marker;
}
<p id="demo"></p>
but it throws me [object]
To read from txt I can not convey it in some way. The file will be in a file server
Thank you for your time!
filterMarkers = function (category) {
for (i = 0; i < markers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// Categories don't match
else {
marker.setVisible(false);
}
document.getElementById("demo").innerHTML = "You selected: " + marker;
}
<p id="demo"></p>
filterMarkers = function (category) {
for (i = 0; i < markers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// Categories don't match
else {
marker.setVisible(false);
}
document.getElementById("demo").innerHTML = "You selected: " + marker;
}
<p id="demo"></p>
answered Nov 11 at 21:32
Rackal
12
12
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241860%2fgoogle-maps-pins-import-from-txt%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Hi @Rackal, as a rule of thumb, you should provide "Research Effort" when asking in StackOverflow. Also, I know writing in a second language is hard, I am not a native english speaker either, however I'm sure that if you take your time you could came out with a better question.
– Luis Miguel Mejía Suárez
Nov 10 at 21:42
Thanks for the answer, I did my research on stacks but I did not find anything relevant. Unfortunately it does not let me put all the code for this and put the link. My question is simple. I want Markers1 = to read the data from txt files. Also, when I choose a category, I want to display the map results on a <div>. I hope you understand me. Thanks.
– Rackal
Nov 10 at 23:26
I'm not a front-end developer so I can't help you with the second question, but probably you could just repaint the contents of the
div
when you choose a category (attaching an action to the event of the radio button menu). For the first one, maybe this can help? - as long as the file is in a server you could load it, or even better make a simple api that returns the data as a JSON, now if the file is local you would need the user to load it first.– Luis Miguel Mejía Suárez
Nov 11 at 16:56