live_map-interface icon indicating copy to clipboard operation
live_map-interface copied to clipboard

Marker accuracy

Open TGRHavoc opened this issue 5 years ago • 15 comments

So, it's known that markers aren't very accurate. Well. They are accurate (they used to be miles away from their actual location when I originally ported over to Leaflet) but, not 100% accurate.

So, I'm putting this issue up so people can see that I know about the "issue" (I don't even want to call it that but, whatever) and as a place for people to discuss ideas on how to fix etc.

As of writing this, 828eefc50d85048b0bb4b0220df9f496a2e0a817 is the current code used to calculate the marker's positions. I'm pretty positive that the issue's with the accuracy are to do with the differences between the map used in the interface

see this

and the reference map I've been using for the coordinates

reference

There's also this resource which, I'm too stupid to understand.

TGRHavoc avatar Apr 16 '19 18:04 TGRHavoc

Is it really just getting the ratio between ingame and Leaflet map numbers right to fix it?

JasonO99 avatar Apr 26 '19 20:04 JasonO99

Is it really just getting the ratio between ingame and Leaflet map numbers right to fix it?

That's what I think but, I'm not 100% certain on. It seems messing with where the Leaflet coords match up with the game coords works but, I feel like this is the naive approach.

TGRHavoc avatar Apr 27 '19 10:04 TGRHavoc

Havoc, did you get anywhere further with this?

I've been playing around with Leaflet's CRS L.Transformation feature to try and put [0,0] in GTA's [0,0] then translate the scale.

However, the scale does not appear to be consistent. In that, the scale of map units doesn't seem to be constant. Matching it to an in-game coordinate will differ depending on how far away from the center you go. I think this is a different method to how you're doing it that I can see, but could be the same issue?

Ultimately I've got someone to stand at different points on the map and give me the coordinate and once you match the scale between [0,0] and say [1000,0] it can look fine, but then [500,0] won't be accurate as expected. Is GTA not a flat world?

JasonO99 avatar Jun 03 '19 01:06 JasonO99

I can see the frustration. At one point I thought I had a nice way of scaling the coordinates but it seems it's broken again and the position is off. It appears the X axis (East <> West) suffers quite bad in being incorrect the further you go out, but the Y value isn't too bad (although some roads line up better than others).

JasonO99 avatar Jun 04 '19 14:06 JasonO99

Are we any further on this, or does this still need some more investigation and testing etc?

JustinRijsdijk avatar Nov 20 '19 10:11 JustinRijsdijk

Popping this link here so my dumb brain doesn't forget: https://stackoverflow.com/questions/54816178/how-are-the-bounds-calculated-in-the-leaflet-crs-simple-tutorial

Hopefully using CRS.Simple will allow us to just place markers directly on the map without having to do maths.

TGRHavoc avatar Oct 22 '21 18:10 TGRHavoc

Popping this link here so my dumb brain doesn't forget: https://stackoverflow.com/questions/54816178/how-are-the-bounds-calculated-in-the-leaflet-crs-simple-tutorial

Hopefully using CRS.Simple will allow us to just place markers directly on the map without having to do maths.

this makes a lot of sense, and seems like it could actually work for the livemap project

JustinRijsdijk avatar Oct 25 '21 17:10 JustinRijsdijk

@JustinRijsdijk Yup. I must be too dump to do it though. I've tried to calculate the bounds for leaflet and stuff using this resource but, I've not been able to get anywhere.

What I mean by this is that [0,0] corresponds to the top left corner of the map. Then, [0, tileWidth] corresponds to the top middle of the map. This makes sense to me. What doesn't make sense is how the hell I'm supposed to "move" the center [0,0] to be the true center of GTA. If we can solve this issue then, we might be able to increase the accuracy a huge amount and further tweak it by overriding CRS.Simple's transform function allowing us to make 1 map unit the same as 10 GTA units (testing would be needed to find the right ratio).

TGRHavoc avatar Oct 25 '21 17:10 TGRHavoc

On the example on that thread they said the value is the offset from the bottom left; then you say how many pixels from bottom left it is to that 0,0 point - is that not actually as simple as it sounds?

JasonO99 avatar Oct 25 '21 18:10 JasonO99

the problem with the gta map images is that it is not a single image, but rather 6 images. So I think that that is a tricky part

JustinRijsdijk avatar Oct 25 '21 18:10 JustinRijsdijk

@JasonO99

On the example on that thread they said the value is the offset from the bottom left; then you say how many pixels from bottom left it is to that 0,0 point

Yeah, that's what I thought but I've not even been able to get [0,0] into the bottom left; always the top. I've tried for a few hours trying to get the GTA map to start at the bottom.

To test I've also tried to set the bounds to [[0,tileWidth], [0, tileWidth*2]]. Which still didn't seem to move [0,0]... Unless I'm missing something stupidly simple.

TGRHavoc avatar Oct 25 '21 18:10 TGRHavoc

@TGRHavoc

Yeah, that's what I thought but I've not even been able to get [0,0] into the bottom left; always the top. I've tried for a few hours trying to get the GTA map to start at the bottom.

I've been working on a web project that uses a leaflet for the map interface. Have the same issue. I came to see if you used leaflet or Google maps still, but you now use leaflet.

Oddly same issue on my end, the further away I get from the area in the attached image, the more it gets off from the real player's location and pulls it towards this area.

FAXES avatar Dec 09 '21 12:12 FAXES

Also, while digging through GitHub and other maps I found https://ttmap.eu

This marker accuracy is spot on, while also using a different way to the standard CRS.Simple method we share in our projects

https://github.com/supernovaplus/ttmap

FAXES avatar Dec 09 '21 13:12 FAXES

@FAXES Thanks for that, I'll deffo have a look when I get some free time after I've done the webpack refactor.

It looks like they've split their images up into separate tiles so I don't know if that's the reason Leaflet is accurate on their side. Heck, it might be the custom CRS they have.

TGRHavoc avatar Dec 09 '21 14:12 TGRHavoc

Hey Jordan, Just checking back. Was there already some progress on this? Do we need to research more things? Can we help in any way?

JustinRijsdijk avatar Apr 21 '22 18:04 JustinRijsdijk