mariusandra / pigeon-maps

ReactJS Maps without external dependencies
https://pigeon-maps.js.org/
MIT License
3.45k stars 142 forks source link

Any provider to integrate bing satellite imagery? #183

Open maifeeulasad opened 1 year ago

maifeeulasad commented 1 year ago

My current solution doesn't work

Source (related):

const getLatLng = (x: number, y: number, z: number) => {
    const radius = 200;

    var latRads = Math.acos(y / radius);
    var lngRads = Math.atan2(z, x);
    var lat = (Math.PI / 2 - latRads) * (180 / Math.PI);
    var lng = (Math.PI - lngRads) * (180 / Math.PI);

    return [lat, lng - 180];
  };

  const providerBing = (x: number, y: number, z: number, dpr?: number) => {
    const latLon = getLatLng(x, y, z);
    // console.debug(latLon);
    return `https://dev.virtualearth.net/REST/V1/Imagery/Map/Aerial/${latLon[0]},${latLon[1]}/${z}?ms=1024,104&key=${mapboxApiKey}`;
  };

Sandbox to quickly debug: https://codesandbox.io/s/tile-boundary-8mo96w?file=/src/App.tsx

This is more of a support question, but couldn't find that discussion tab, so I'm creating this issue. Thanks.