Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker accuracy #34

Open
TGRHavoc opened this issue Apr 16, 2019 · 15 comments
Open

Marker accuracy #34

TGRHavoc opened this issue Apr 16, 2019 · 15 comments

Comments

@TGRHavoc
Copy link
Owner

TGRHavoc commented Apr 16, 2019

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, 828eefc 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.

@JasonO99
Copy link

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

@TGRHavoc
Copy link
Owner Author

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.

@JasonO99
Copy link

JasonO99 commented Jun 3, 2019

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
Copy link

JasonO99 commented Jun 4, 2019

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).

@JustinRijsdijk
Copy link

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

@TGRHavoc
Copy link
Owner Author

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.

@JustinRijsdijk
Copy link

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

@TGRHavoc
Copy link
Owner Author

@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).

@JasonO99
Copy link

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?

@JustinRijsdijk
Copy link

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

@TGRHavoc
Copy link
Owner Author

TGRHavoc commented Oct 25, 2021

@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.

@FAXES
Copy link

FAXES commented Dec 9, 2021

@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
Copy link

FAXES commented Dec 9, 2021

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

@TGRHavoc
Copy link
Owner Author

TGRHavoc commented Dec 9, 2021

@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.

@JustinRijsdijk
Copy link

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?

@TGRHavoc TGRHavoc self-assigned this Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants