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








share|improve this question




















  • 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















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








share|improve this question




















  • 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













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








share|improve this question


















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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














  • 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








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












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!






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























    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!






    share|improve this answer

























      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!






      share|improve this answer























        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!






        share|improve this answer












        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>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 21:32









        Rackal

        12




        12






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Full-time equivalent

            さくらももこ

            13 indicted, 8 arrested in Calif. drug cartel investigation