Jump to content
  • Sign Up

Tile Service [Quick Fix]


Reincarnated.1754

Recommended Posts

I don't know who dose the Tiles on Wiki but I have a quick fix if they are interested.

There is two things to change just a few lines.

This may be temporary (HA HA) so note your code to return back to normal when fixed by ArenaNet. (As If)

 

Could do with a code format button, so I have numbered code lines `code`

 

First is the  unproject function.

 

  1. `code`        function unproject(coord) {
  2. `code`            if (Continent === 2) {
  3. `code`                return map.unproject(coord, map.getMaxZoom());
  4. `code`            } else {
  5. `code`                var newValueX = coord[0] - 32768; //128 tiles
  6. `code`                var newValueY = coord[1] - 16384; //64 tiles
  7. `code`                return map.unproject([newValueX, newValueY], map.getMaxZoom());
  8. `code`            }
  9. `code`        }

 

If you made some none API icons, that is, use pre-fixed coordinates, then you need to use the original unproject function. I made a separate unprojectX(coord).

 

Second is the origin of the maps.

This only matters if you intend to make some new Tiles.

I keep dreaming that ArenaNet find someone who knows how how to make the Tiles. #wher's that pipe#

  1. `code`        MapContinents = $.getJSON("https://api.guildwars2.com/v1/continents.json"

Only gives overall size of map.

I doubt that ArenaNet are going to move all the Tiles to a new Zero Origin. (This may have gone over some heads)

Currently it assumed the Zero Origin = 0,0.

They have increased the overall map size but also increased it Northwards and to the West. (Zero Origin moved East and South)

I reckon:

South 2304, 9 Tiles.

East 19456, 76 Tiles.

So.

  1. `code`            var MapOffsetSouthWestN = -19456; // 76 Tiles.
  2. `code`            var MapOffsetNorthEastN = -2304; // 9 Tiles.
  3.  
  4. `code`            // Get Map Continents-----------------------
  5. `code`            var MapContinents = $.getJSON("https://api.guildwars2.com/v1/continents.json", {
  6. `code`            })
  7. `code`                .fail(function () {
  8. `code`                    TyriaMapSizeNE = 81920;
  9. `code`                    TyriaMapSizeSW = 114688;
  10. `code`                    MistsMapSizeNE = 16384;
  11. `code`                    MistsMapSizeSW = 16384;
  12. `code`                    //=======
  13. `code`                })
  14. `code`                .done(function (jsonData) {
  15. `code`                    Continents = jsonData.continents;
  16. `code`                    TyriaMapSize = Continents[1].continent_dims;
  17. `code`                    TyriaMapSizeNE = TyriaMapSize[0];
  18. `code`                    TyriaMapSizeSW = TyriaMapSize[1];
  19.  `code`                   MistsMapSize = Continents[2].continent_dims;
  20. `code`                    MistsMapSizeNE = MistsMapSize[0];
  21. `code`                    MistsMapSizeSW = MistsMapSize[1];
  22. `code`                    //=======
  23. `code`                })
  24. `code`                .always(function () {
  25. `code`                    if (Continent === 2) {
  26. `code`                        MapMinZoom = 3;
  27. `code`                        MapMaxZoom = 6;
  28. `code`                        southWest = map.unproject([0, MistsMapSizeSW], MapMaxZoom);
  29. `code`                        northEast = map.unproject([MistsMapSizeNE, 0], MapMaxZoom);
  30. `code`                    }
  31. `code`                    else {
  32. `code`                        MapMinZoom = 3;
  33. `code`                        MapMaxZoom = 7;
  34. `code`                        southWest = map.unproject([MapOffsetSouthWestN, TyriaMapSizeSW + MapOffsetSouthWestN], MapMaxZoom);//lat: -744, lng: -152
  35. `code`                        northEast = map.unproject([TyriaMapSizeNE + MapOffsetNorthEastN, MapOffsetNorthEastN], MapMaxZoom);//lat: 18, lng: 622 
  36. `code`                    }
  37. `code`                    map.setZoom(MapMaxZoom);
  38. `code`                    map.options.maxZoom = MapMaxZoom;
  39. `code`                    map.options.minZoom = MapMinZoom;
  40. `code`                    map.setMaxBounds([southWest, northEast]);
  41. `code`                    //=======
  42. `code`                });
  43. `code`        }

 

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...