In the yaml-settings of a map, it's not possible to center it on the LatLong [0, 0]. Doing so will cause leaflet to use the default coordinates as configured in the settings. A workaround is to enter the coordinates as strings, see below:
Example code:
This should produce a map of the South Atlantic Ocean near Africa's west-coast, but shows Indianapolis instead:
id: test
lat: 0
long: 0
This config will produce the desired result:
id: test
lat: "0"
long: "0"
Obsidian Version: 1.1.16
Leaflet Version: 5.2.6
Potential fix
The issue is caused by a couple of boolean comparisons (starting here) on the supplied lat/long that should probably just be replaced with undefined checks?
For example:
if (!latitude || isNaN(coords[0])) {
coords[0] = this.plugin.data.lat;
}
In the yaml-settings of a map, it's not possible to center it on the LatLong [0, 0]. Doing so will cause leaflet to use the default coordinates as configured in the settings. A workaround is to enter the coordinates as strings, see below:
Example code:
This should produce a map of the South Atlantic Ocean near Africa's west-coast, but shows Indianapolis instead:
This config will produce the desired result:
Obsidian Version: 1.1.16 Leaflet Version: 5.2.6
Potential fix
The issue is caused by a couple of boolean comparisons (starting here) on the supplied lat/long that should probably just be replaced with undefined checks?
For example:
should be turned into:
If that's all it would take, I'm happy to open a PR, but I'm not sure I missed something else since this codebase is quite extensive! :D