Google maps or openstreet maps customization - Forum | JoomShaper
Staff replied SP Page Builder

Google maps or openstreet maps customization

Asked by serge 5 years ago Last activity 5 years ago

Hello, I would like to add some customization to the maps (Google or openstreet no matter).
Like:

  1. itinerary between two points
  2. Draw circles around a selected point.

Is it possible and how?

Thank you.

8 replies

serge Asked this

Thank you Ariba!
But where to put this javascript code, how to access to a particular map on the particular page of SP Page builder?

Ariba Staff

You are most welcome.

Kindly check the screenshot below:

in_head.png

You can insert custom Javascript code in the Custom Code section if you are using Helix framework.

serge Asked this

But I'm not using helix ultimate.

serge Asked this

Should I link the javascript code to the #id of the native SPPage builder google map : sppb-addon-gmap-1622223646265

Or I should create a custom module with all google map's html and javascript and then publish it in SpPage builder?

serge Asked this

I've put this code into the js file, but nothing happens.
I use #id of the existing Pagebulder google map.

        const citymap = {
    paris: {
      center: { lat: 48.85648185039337, lng: 2.3498061650287094 },
      population: 2714856,
    },
  };

  function initMap() {
    // Create the map.
    const map = new google.maps.Map(document.getElementById("**sppb-addon-gmap-1622293635357**"), {
      zoom: 4,
      center: { lat: 48.85648185039337, lng: 2.3498061650287094 },
      mapTypeId: "roadmap",
    });

    // Construct the circle for each value in citymap.
    // Note: We scale the area of the circle based on the population.
    for (const city in citymap) {
      // Add the circle for this city to the map.
      const cityCircle = new google.maps.Circle({
        strokeColor: "#FF0000",
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: "#FF0000",
        fillOpacity: 0.35,
        map,
        center: citymap[city].center,
        radius: Math.sqrt(citymap[city].population) * 100,
      });
    }
  }
Paul Frankowski Senior Staff

We can give only general tips, sorry but we don't help with code customization, it's against Support Policy rules.

Probably in your case you have to ask developer (freelancer) for help.

Log in to reply.