I am copying GPS coordinates into a text file to use for a website displaying a google map. Before, I was using a php script to take the gps coordinates and some long strings to create a kml document that I could display. That doesn’t seem like the best way. I have the text file, gpsinfo.txt, with information for 4 datapoints that looks like this when opened:
7.784606,63.10403 7.784606,64.10403 7.784606,65.10403 7.784606,66.10403
How should I use that text file to create the 4 points on my webpage?
I was thinking about using a php file to create a js file that my webpage could read, but that doesn’t sound like a very clean method.
This is what I am doing to solve this:
I have a php file scrape some webpages to get GPS coordinates, and then I copy them into a text file but in a JSON format:
Then I have a php file that is reads the file and is accessed by my webpage using ajax and outputs the string and then the webpage handles it.
ajax on webpage:
genjsonGPS.php: