• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Beginner Question on Variables from file

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a web page, (not originally written by me)
which basically displays google markers. I want to get the marker information from a text file each time the page is refreshed or opened.
Is this possible can someone possibly point me in the right direction, I have done lots of researching but keep falling flat on my face I am just not experienced enough.
Code below, its the var stops i want to import, i can generate the file in that format.
Many thanks to anyone who can assist.





 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chris, welcome to Code Ranch!

Where is the text file that you want to read? Is it on the client (i.e., where the browser is running), or is it on a server? Also, how do you open the web page? Do you open it directly via an Open File menu option in your browser, or do you type the address of a server to get it? If the latter, do you know what kind of server is running?
 
chris beagan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Greg,

Many thanks for your post, I managed to get it working eventually with a lot of bother but it may not be the best way I would be interested in your opinion.
I was hosting the page locally but it is now hosted on a web server, I copy the routes.txt file from my pc to the web server then launch the webpage inside an access database.
I added the code below to the webpage to read the routes.txt file.

Another thing i would like to do with the code is rather than show the markers with letters i would prefer them numbered.


 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the file contains JSON, it should be named .json not .txt.

Another thing i would like to do with the code is rather than show the markers with letters i would prefer them numbered.



Somewhat surprisingly, and most definitely aggravatingly, the Google Maps API makes it fairly difficult to put text on a map. You have the option of using a single character for markers using Marker Labels but if you need more than that, you need to create a custom overlay that creates custom HTML elements to put text onto the map.

I think I have such an overlay laying around that I could share if you like, but it's not simple.

You'd think that such a common and simple need would be provided for, but no-o-o-o-o-o-o-o.
 
I've never won anything before. Not even a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic