Converting Event Radius

Converting Event Radius

in API Development

Posted by: AysonCurrax.3254

AysonCurrax.3254

Does anyone know how i can convert the radius for an event from the event_details api so that i can properly use it on a leaflet js map? I am sorta failing to figure it out so any kind of help would be much appreciated.

Converting Event Radius

in API Development

Posted by: smiley.1438

smiley.1438

I know it was discussed here, but i can’t find the right topic anymore because reasons.

Anyway, i think this might help: https://forum-en.gw2archive.eu/forum/community/api/Event-Details-API-location-coordinates/first#post3546948 (have a look at the whole tread)

Converting Event Radius

in API Development

Posted by: AysonCurrax.3254

AysonCurrax.3254

I know it was discussed here, but i can’t find the right topic anymore because reasons.

Anyway, i think this might help: https://forum-en.gw2archive.eu/forum/community/api/Event-Details-API-location-coordinates/first#post3546948 (have a look at the whole tread)

thanks you. I already found that one earlier though which helped with translating map_rect into continent_rect, but i dont remember seeing anything about radius on there, sadly.

project and unproject only work on specific coordinates, though. once i unprojected the value to fit on the map I cant seem to use the adjusted value for others calculations it seems.

I tried something along the lines of unproject([continentX + radius, continentY]) – unproject([continentX, continentY]), but nothing works.

Converting Event Radius

in API Development

Posted by: smiley.1438

smiley.1438

The x,y,z coords are in meter so you have to convert it to inches knowing that 1 meter = 39.3700787 inches.

According to Cliff :

Some implementation notes:
The coordinate system used by mumble is slightly different than the game. GW2 uses inches (don’t ask), but mumble uses meters. So you’ll need to convert the coordinates back to inches for use with the map API.

Basically this.

http://leafletjs.com/reference.html#circle
Leaflet uses meter as units, so you just need to recalculate the radius given by the events API from inch to meter.

L.circle(map.unproject([cx, cy]), radiusInch/39.3700787).addTo(map);