Jump to content

How do I convert a pair of lon and lat values into a point....?


Followers 2

Recommended Posts

Use the built-in VectorToPoint function.

 

local p1 = ZonePoint(47.6490674, -122.3479173, 0);
local p2 = ZonePoint(47.6205063, -122.3492774, 0);

local distance, bearing = Wherigo.VectorToPoint(p1, p2);

print(distance:GetValue("m")); -- 3175.3430431868
print(bearing); -- 181.83845927044

 

Edited by Hügh
  • Helpful 2
Link to comment
On 6/20/2021 at 9:00 PM, Forest-Ghost said:

Does anyone know how to use the VectorToPoint function in urwigo? I am trying to build a reverse cache using just the bearing. I keep getting errors though.

 

14 hours ago, Delta68 said:

I can't get it to work either.

Passing a zone to a function or referencing a zone in a funtion always errors :(

 

Can both of you post (or e-mail me) the source code of your cartridge? As of now the problem could be literally anything from "you've got a typo on line 100" to "a solar flare fried your computer"... :P

Edited by Hügh
Link to comment

I was able to get it working using Day1976's code from this post. I threw together a rough cartridge. You can download the urwigo file here: https://www.dropbox.com/s/7ezvqi5vgebwq7r/Reverse Bearing Wherigo.urwigo?dl=0

 

 

I'd be curious to see if anyone else has made a reverse bearing Wherigo and if they have any recommendations. I made a reverse Wherigo (showing only the distance) awhile back that took players to an obscure park that most people didn't know existed. The starting coordinates were almost 2 miles from the final. I would think with a bearing only Wherigo it might be better to set it up so that the player starts in a park and ends in the same park. Since there is only bearing, I could see it becoming a lot trickier to locate the cache if the starting location is really far away from the final. 

 

 

Edit: for anyone who wants to make a reverse bearing Wherigo without having to use code. day1976 uploaded an open source cartridge here. You can build the entire cartridge in the app.

Edited by Forest-Ghost
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Followers 2
×
×
  • Create New...