Hi smart people! Trying to overly a polyline(route or track) from an uploaded .gpx file to my map component.
Database: spacetimeDB
Uploaded File Name: 100104 (gpx / xml file for GPS data)
map widget: googlemap_42
Here is my JS asset code. I call initialize(); on page Load.
function initialize() {
var race_ID_GPX = "100104";
var db_ID = "5187fbe2e4b0446b3349dffd";
var serverUrl = 'https://api.appery.io/rest/1/spacetim...'+ race_ID_GPX;
Code: Select all
var mapOptions = {
zoom: 11,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map($('div[dsid="googlemap_42"]').get(0), mapOptions);
$.ajax({
type: "GET",
url: serverUrl,
dataType: "xml",
success: function (xml) {
var points = [];
var bounds = new google.maps.LatLngBounds();
$(xml).find("trkpt").each(function () {
var lat = $(this).attr("lat");
var lon = $(this).attr("lon");
var p = new google.maps.LatLng(lat, lon);
points.push(p);
bounds.extend(p);
});
var poly = new google.maps.Polyline({
// Setting line Style
path: points,
strokeColor: "#007ED5",
strokeOpacity: .7,
strokeWeight: 4
});
poly.setMap(map);
// fit bounds to track
map.fitBounds(bounds);
}
});
}
In the console I get this Error:
Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
{"code":"BCXX004","description":"No resource method found for GET, return 405 with Allow header"}
Can you see anything wrong in my code that would cause this error?