Difference between revisions of "User:Kerik Rau/MapTileURL"

From Second Life Wiki
Jump to navigation Jump to search
(New page: Returns the URL of the image of the current sim's tile as in SLURL. Also see Thraxis Epsilon's OpenLayers Wrapper. <lsl> string MapTileURL() { ...)
 
 
Line 1: Line 1:
Returns the URL of the image of the current sim's tile as in SLURL.  Also see [[User:Thraxis_Epsilon/map_api | Thraxis Epsilon's OpenLayers Wrapper]].   
Returns the URL of the image of the current sim's tile (a 256x256 pixel image).  Also see [[User:Thraxis_Epsilon/map_api | Thraxis Epsilon's OpenLayers Wrapper]].   


<lsl>
<lsl>

Latest revision as of 13:35, 16 January 2009

Returns the URL of the image of the current sim's tile (a 256x256 pixel image). Also see Thraxis Epsilon's OpenLayers Wrapper.

<lsl> string MapTileURL() {

   vector TilePos = llGetRegionCorner();

   //tiles are in a grid based on the regions, so 256m = 1 tile
   TilePos /= 256.0;
   
   //offset provided in the javascript, really 1278 + 1 (probably 0 -> 1 index difference?)
   TilePos.y = 1279.0 - TilePos.y;
   
   //should look like http://secondlife.com/apps/mapapi/grid/map_image/x-y-zoom-0
   string mapURL = "http://secondlife.com/apps/mapapi/grid/map_image/";
   mapURL += (string) llFloor(TilePos.x);
   mapURL += "-";
   mapURL += (string) llFloor(TilePos.y);

   //the 3rd value is something to do with zoom
   mapURL += "-1-0";
   return mapURL;

} </lsl>