Skip to content

Getting different bounds compare to leaflet using CrsSimple() #725

@Pinkal7600

Description

@Pinkal7600

I am using the northEast and southWest LatLng to set bounds and it's working perfectly. But, as I compare to the leaflet by doing the same process. I get different bounds in output. How can I make them similar?

flutter_map:

MapOptions mapOptions = MapOptions(
  center: LatLng(0, 0),
  onTap: _handleTap,
  minZoom: 1,
  maxZoom: 4,
  crs: CrsSimple(),
);

LatLng northEast = MapState(mapOptions)
    .unproject(CustomPoint(imageWidth, 0), mapOptions.maxZoom);
LatLng southWest = MapState(mapOptions)
    .unproject(CustomPoint(0, imageHeight), mapOptions.maxZoom); 

LatLngBounds latLngBonds = LatLngBounds(southWest, northEast);
mapOptions.bounds = latLngBonds;

leaflet:

this.previewMap = L.map('previewMap', {
  minZoom: 1,
  maxZoom: 4,
  center: [0, 0],
  crs: L.CRS.Simple,
})

const northEast = this.previewMap.unproject([width, 0], this.previewMap.getMaxZoom())
const southWest = this.previewMap.unproject([0, height], this.previewMap.getMaxZoom())

const bounds = new L.LatLngBounds(southWest, northEast)

Output:

flutter_map:
northEast Lat : -0.0, Lng : 0.5986328125
southWest Lat : -0.626953125, Lng : 0.0

leaflet:
northEast Lat : -0.0, Lng : 153.25
southWest Lat : -160.5, Lng : 0.0

I want to make the output bonds similar for flutter_map and leaflet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions