2

I have a list of lat/lon data that forms a path. The data was obtained using a GPS device from a vehicle on a race track. When I plot this using Google maps JavaScript API (satellite map), it doesn't line up with the track. I'm guessing there are some obvious inaccuracies due to GPS drift and/or satellite position.

see https://jsfiddle.net/3op5znt4/

How would I go about overriding/extending googles current satellite projection to also do an affine transformation on the projected coordinates? I'm hoping to end up with some constant values for scale, shear, rotate and translate that I can use for this area + device combination.

I've been able to get the projection like so, but not sure how to modify it

      map.addListener("projection_changed", () => {
        const merc = mapInstance.getProjection();
        // but how do I modify the projection here?
      });

I've also tried extending the google.maps.Projection interface with the intent to add an affine tranform, but can't seem to find any documentation on how to set this for the satellite map type.

class MyProjection implements google.maps.Projection {
  fromLatLngToPoint(
    latLng: google.maps.LatLng,
    point?: google.maps.Point | undefined
  ): google.maps.Point | null {
    const TILE_SIZE = 256;
    let siny = Math.sin((latLng.lat() * Math.PI) / 180);

    // Truncating to 0.9999 effectively limits latitude to 89.189. This is
    // about a third of a tile past the edge of the world tile.
    siny = Math.min(Math.max(siny, -0.9999), 0.9999);

    return new google.maps.Point(
      TILE_SIZE * (0.5 + latLng.lng() / 360),
      TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI))
    );
  }

  fromPointToLatLng(
    pixel: google.maps.Point,
    noClampNoWrap?: boolean | undefined
  ): google.maps.LatLng | null {
    throw new Error("Method not implemented.");
  }
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.