• Resolved bobadoo

    (@bobadoo)


    Hi there!

    A client of mine is looking for a map that only covers a very limited area, say a single county in a state. This client would like for the rest of the the world to be ‘grayed out’. Is it possible to add polygons to the map without completely overhauling the js?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    I have seen this before ( not sure if it was with OpenStreetMaps or Google Maps ), but I have unfortunately no idea how to implement this. It will require custom code to be added to the wpsl-gmap.js file.

    Thread Starter bobadoo

    (@bobadoo)

    Hey Tijmen,

    Thanks for getting back to me. This was actually simpler than I expected. Something along the lines of:

    var annaMariaCoords = [
    new google.maps.LatLng(27.539451,-82.689516),
    new google.maps.LatLng(27.540668,-82.761582),
    new google.maps.LatLng(27.470020,-82.758837),
    new google.maps.LatLng(27.477026,-82.692605),
    ];

    var worldCoords = [
    new google.maps.LatLng(-85.1054596961173, -180),
    new google.maps.LatLng(85.1054596961173, -180),
    new google.maps.LatLng(85.1054596961173, 180),
    new google.maps.LatLng(-85.1054596961173, 180),
    new google.maps.LatLng(-85.1054596961173, 0)
    ];

    // Construct the polygon.
    var poly = new google.maps.Polygon({
    paths: [worldCoords, annaMariaCoords],
    strokeColor: ‘#000000’,
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: ‘#000000’,
    fillOpacity: 0.35
    });

    poly.setMap(map);

    would do just fine. However, it’s not going to work to have the edits rewritten every time the client updates the plugin. Any thoughts on how I can access the map variable from a different function/file?

    Thanks ahead of time!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Polygons/Masking’ is closed to new replies.