Slluxx / TOTK-Interactive-Map

GNU General Public License v3.0
22 stars 4 forks source link

Raster Coords implementation for mobile #31

Closed pratikbaid3 closed 1 year ago

pratikbaid3 commented 1 year ago

Hi,

I am working on a native mobile application using the map and the coordinates in this project. I was ale to get the map to render but was having trouble rendering the markers. I think the issue is with the Raster Coordinates. Any help willbe really appreciated

This is the conversion I am using

LatLng rasterToLatLng(Point<num> rasterCoords) {
    LatLngBounds bounds = mapController.bounds!;
    Size mapSize = Size(36000, 30000);
    print(bounds.southWest);
    final x = bounds.southWest.longitude +
        (rasterCoords.x / mapSize.width) *
            (bounds.northEast.longitude - bounds.southWest.longitude);
    final y = bounds.northEast.latitude -
        (rasterCoords.y / mapSize.height) *
            (bounds.northEast.latitude - bounds.southWest.latitude);

    return LatLng(y, x);
  }

Any help will be really appreciated.

pratikbaid3 commented 1 year ago

simulator_screenshot_EBE457E0-9A99-4660-A770-7D8D3829E4FB The markes looks to be at the right place horizontally but off vertically

pratikbaid3 commented 1 year ago

Screenshot 2023-05-23 at 10 50 00 AM This is where it should be