1

I am using Leafletjs in Nuxt by using a NPM package. Thus I am using a wrapper to use Leafletjs in Nuxt.

The problem I have now is with this piece of code:

<l-map
  :zoom="4"
  :center="[0, 0]"
  :max-zoom="6"
  :min-zoom="3"
  :options="{ attributionControl: false }"
  @mousedown="mouseMovClick($event)"
>
    <l-circle
      :lat-lng="[markerPosition.lat, markerPosition.lng]"
      :radius="100000"
      color="rgba(76, 211, 40, 0.9)"
      :fill="false"
      :weight="2"
    />
    
    <l-circle
      :lat-lng="[markerPosition.lat, markerPosition.lng]"
      :radius="200000"
      color="rgba(76, 211, 40, 0.9)"
      :fill="false"
      :weight="2"
    />
    
    <l-circle
      :lat-lng="[markerPosition.lat, markerPosition.lng]"
      :radius="300000"
      color="rgba(76, 211, 40, 0.9)"
      :fill="false"
      :weight="2"
    />
</l-map>

For each "circle" that I add, they obviously become bigger. But they also become more "egg" shaped for some reason that I do not understand.

Does anyone know what could be wrong or what could be causing this anomaly?

EDIT: Found out, well, I think that the circle is bending to the shape of the earth. In my case I do not want it to bend. It should always remain a perfect circle. Is that possible?

I added this to my code:

import { CRS } from 'leaflet'

And inside my setup:

const crs = CRS.Simple

This seems to be working, but now I end up with this error:

window is not defined

var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer

EDIT: I got it working (will update my post soon), but the next problem now is that the image names have changed and thus the map does not load anymore.

I am using this script to make the tiles in Photoshop.

https://github.com/bramus/photoshop-google-maps-tile-cutter

I have no options/ influence for the names. So, when I do not set the CRS the names are correct i.e. 5/4/2.png but when I use CRS the names change to i.e. 5/4/-2.png and those do not exist.

I also tried https://github.com/libvips/build-win64-mxe/releases but that gives me a weird output where all tiles will be unsorted somehow.

vips.exe dzsave IMAGE_LOCATION FOLDER_LOCATION --layout google --background 0E0E0E --centre --suffix .png[Q=100]

I think I have to, somehow, have to make sure that the map only starts and ends within these folders:

1/1/1.png up to 1/24/64.png
2/*/*
3/*/*
4/*/*
5/*/*
6/1/1.png up to 6/24/64.png

where all numbers are positive never negative. The same applies to the image names. Always positive numbers never negatives. The above reassembles my directory structure after tiling the images.

Also, another thing that happend is when I refresh my map, the markers look like they are in place, but the map itself has moved away to the bottom right for some reason. No clue why it shifted.

  • Tried this one? https://stackoverflow.com/a/67751550/8816585 – kissu Apr 21 '22 at 12:32
  • Oh... yeah, I have it wrapped in so that should be good :) –  Apr 21 '22 at 12:41
  • There is a bit more than just `client-only` in my answer. – kissu Apr 21 '22 at 12:47
  • Well, I don't use any java script myself so I cannot do anything there to be honest. All I do is include the components that come from the https://github.com/schlunsen/nuxt-leaflet package. I will try to find out if there is any more that I can do! I think it has to do with the import { CRS } from 'leaflet'. var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer; –  Apr 21 '22 at 12:53
  • Hi, please do not post code snippets in comments but rather edit your question. Did you read the last part of my answer? – kissu Apr 21 '22 at 13:14
  • Understood, sorry. I got it working (will update my post in a bit). Unfortunately I am running into a different problem now. The tiles (png images) requested have changed name since I use CRS.Simple now. Therefore no images are loaded anymore and I am unable to change the image names in all honesty. I am using a tile cutter script for Photoshop (see my main post) to generate the tiles. –  Apr 21 '22 at 13:25
  • How did you run libvips? You'll need the flag `--layout google` to generate a google maps (ie. leaflet) compatible pyramid. See the docs: https://www.libvips.org/API/current/Making-image-pyramids.md.html – jcupitt Apr 21 '22 at 14:15
  • Yeah I did that! vips.exe dzsave IMAGE_LOCATION FOLDER_LOCATION --layout google --background 0E0E0E --centre --suffix .png[Q=100] but it is oké, I still have the Photoshop plugin which works, just takes longer. I updated my post btw. I think everything is working now except for the image names but that probably has to do with the coordinates. Maybe I have to position the map (if that is possible?) so that only positive numbers are used? –  Apr 21 '22 at 14:20
  • Well, instead of wasting more time I decided to center my map on where the picture (map) is. That works well. Now I just have to redo all of my markers unfortunately but I guess that is what happens when you change CSR. Thanks for your help! really appreciated! –  Apr 21 '22 at 15:18

0 Answers0