Skip to content

Instantly share code, notes, and snippets.

@timotheemoulin
Created February 20, 2023 09:39
Show Gist options
  • Save timotheemoulin/a593b89aaefbabdd4c1c91e16b47a30f to your computer and use it in GitHub Desktop.
Save timotheemoulin/a593b89aaefbabdd4c1c91e16b47a30f to your computer and use it in GitHub Desktop.
Test OA MAP integration
<script type="text/javascript" defer="true" src="//www.outdooractive.com/alpportal/oa_head.js?proj=api-aupaysdustbernard&amp;key=IRFNHNTB-EMWGMGXI-4OSSAFZ3&amp;lang=fr" done="true">
</script>
<script>
(function (){
$(function () {
oax.api.maps(initOAX);
function initOAX(oamaps, gm) {
// a single tour
var content = '53827260';
var layerConfig = {
markersActive: true,
defaultIW: true
};
// initialize GeomLayer
layer = new oamaps.GeomLayer(content, layerConfig);
layer.whenLoaded(initMap);
function initMap() {
var mapDiv = document.getElementById("outdooractive-map");
var mapTypeIds = ['oa_map', 'oa_topo', 'oa_map_winter'];
var mapConfig = {
bounds: layer.getBounds(),
mapTypeId: mapTypeIds[0],
mapTypeControlOptions: {mapTypeIds: mapTypeIds}
};
var map = oamaps.map(mapDiv, mapConfig);
// add GeomLayer to map
layer.setMap(map);
}
}
});
})(jQuery);
</script>
@timotheemoulin
Copy link
Author

Affiche les erreurs suivantes :

  • Uncaught TypeError: oax.pdfDialog is not a function
  • Uncaught TypeError: Cannot read properties of undefined (reading 'maps')

L'objet oax ne semble pas avoir été instancié complètement. Ci-dessous oax dans la console JS.

{
    "_ORIGIN_URL": "https://www.outdooractive.com/alpportal/oax_head.js?proj=api-aupaysdustbernard&key=IRFNHNTB-EMWGMGXI-4OSSAFZ3&lang=fr&ver=6.0.3",
    "_CRR_SERVER": "https://crrcms.outdooractive.com/",
    "_ORIGIN_BUILD": "full",
    "_default_head": 1
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment