hupe13 / extensions-leaflet-map-github

WordPress Plugin Extensions for Leaflet Map - Github Version
GNU General Public License v2.0
13 stars 4 forks source link

Geosearch and LocateControl plugins issues #11

Closed Oufrid closed 1 year ago

Oufrid commented 1 year ago

I did follow your step by step instructions to include the geosearch and locatecontrol plugins but there are some issues:

The geosearch plugin does not update the map with the new location after putting or selecting an address. (Tried both codes)

The locatecontrol plugin is blurring the map when it is displaying your location, it's just like if it puts a layer over the map and displaying only a big circle with a marker at the center, the map is not visible anymore, so you can't really see where you are located "on the map".

hupe13 commented 1 year ago

The geosearch plugin does not update the map with the new location after putting or selecting an address. (Tried both codes)

There is an error in the new Geosearch version (issue), the version 3.9.0 works. Download the files from https://unpkg.com/leaflet-geosearch@3.9.0/dist/geosearch.umd.js and https://unpkg.com/leaflet-geosearch@3.9.0/dist/geosearch.css. I changed my instructions.

The locatecontrol plugin is blurring the map when it is displaying your location, it's just like if it puts a layer over the map and displaying only a big circle with a marker at the center, the map is not visible anymore, so you can't really see where you are located "on the map".

I tested it again on Android and it looks like the author's example. On his site you can find some options you can adapt.

Does my example work for you?

Oufrid commented 1 year ago

Yes, your example works just fine, so I will just try to add some options and see if I can fix the extra layer problem. Thank you so much for your help

Oufrid commented 1 year ago

Hello, do you know why the leaflet map WordPress plugin is using incorrect coordinates for locations? For example the location of 34.0343,-4.9979 are located in 72.xxxx,529.xxxx in leaflet map wordpress plugin. That's why the locate control does not display the correct location in maps despite getting the correct coordinates.

hupe13 commented 1 year ago

I cannot reproduce this. A map with the marker shows the same place as Google maps:

[leaflet-map lat=34.0343 lng=-4.9979 zoom=10]
[leaflet-marker]

But I know, there are different coordinate systems: https://www.geoplaner.com/

Oufrid commented 1 year ago

That's weird, because when I use the short code you provided I get a location in America around Somerset Island while those coordinates are actually in morocco. Seems like the plugin is using a flat projection system EPSG 3857, instead of using a 3d projection EPSG 4326.

hupe13 commented 1 year ago

Leafletjs has as default EPSG 3857. I do not have the knowledge about this. You are the only one with this problem.

Oufrid commented 1 year ago

I finally found the issue, I was setting the tile layer size to 512 pixels instead of 256 and that's why I was getting a bad projection. Now everything is working fine, sorry for the confusion.