Google maps pins import from .txt












-2

















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
















-2

















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














-2












-2








-2


0








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




4,21422451










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


















0














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',
    autoActivateHeartbeat: false,
    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









    0














    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


























      0














      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
























        0












        0








        0






        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




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            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







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini