1

I'm trying to create a webmap that shows a single point on a map. The point is the location of a GPS device and is refreshed approximately every 10 minutes. The GPS company has provided a public XML endpoint that exports the data I need, but I don't know my way around web programming. The link to the endpoint I'm trying to extract data from is: https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/0BBk2RhP8BxXzRbdRKenMK0rLB4zXNqY2/latest.xml

I could use some guidance in:

  1. Reading Lat and Long data from the XML endpoint above (I took a shot at it below with jquery but had no luck)

  <script>
 $(document).ready(function()
 {
  $.ajax({
   type: "GET",
   url: "https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/0BBk2RhP8BxXzRbdRKenMK0rLB4zXNqY2/latest.xml"
   dataType: "xml",
   success: parseXml
  });
 });
 
  $(this).attr("example")
  </script>
  1. Creating a variable with the lat and long data from the XML subelements.

From there I can add the point to a map using leaflet, but I can't seem to get past step 1.

zemken12
  • 59
  • 1
  • 6
  • 1
    A simple test reveals that if you change the URL to request `.json` instead of `.xml`, the API returns good JSON which will be easier to deal with in your code. – peeebeee Jan 06 '20 at 07:29

0 Answers0