LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Choose a value from a Longitude input

Solved!
Go to solution

Greetings,
I think this will be a fairly basic question, but I am having trouble choosing the best function. Here's what I want to do:

 

I have a GPS feed in my main VI giving Latitude and Longitude. I want to use the Longitude value to determine which UTM zone I'm in. There are 60 zones, each with a width of six degrees. With a value of Longitude, I need to look up a table or an array to find which zone number is. Zone 1 covers longitude 180° to 174° W; zone numbering increases eastward to zone 60, which covers longitude 174° to 180° E. For example, with a longitude of 153 (here in Brisbane) the function should choose the value of 56 and spit it out. The only thing that changes is my current longitude, so the table with the zone values and corresponding longitude values never needs to be updated.

 

The coordinate stuff is not so much the question here, rather the most efficient way to have LabVIEW regurgitate a given value for a variable input.

 

Thanks

0 Kudos
Message 1 of 6
(3,506 Views)
Solution
Accepted by topic author KarlosAmigos

Hi KarlosAmigos

 

I'd just like to do some manipulation of the input... 

I hope I'm not misunderstand your question, and I'm wondering if there's other more efficient way...

 

20160711001.png

Message 2 of 6
(3,484 Views)

This is a simple Math problem.  Take a piece of paper, write one Zone boundary (say, 180°) in it, and beside it put the Zone number (60).  Now do the next Zone, and the next, and the next.  Do you see a pattern?  Can you think of a mathematical function that (a) takes "integer" jumps (since there's no Zone 59.4) and (b) is related, somehow, to the width of the Zone (6°)?  Now all you have to do is get the offset and the sign right and (you'll forgive the atrocious pun) "Bob's Your Uncle".

 

Bob Schor

0 Kudos
Message 3 of 6
(3,480 Views)

Thanks William,

Using just a mathematical manipulation works like a charm. With one minor addition.

To get the right zone, I had to add an increment function just after the quotient and remainder function. I have tried different coordinates from both hemisphere's and now it always returns the right zone. Many thanks for this solution!

 

Karl

 

 

0 Kudos
Message 4 of 6
(3,434 Views)

Thanks Bob,

You are right and William1225 was kind enough to put a picture up of the maths.

 

From a coding point of view, I was wanting to learn how to use maybe an array to do this. For the latitude zones in UTM format for example, these are designated by letters every 8 degrees (In Brisbane for example, I am in UTM zone 56J. Anything between latitude 24S and 32S is in J), so the maths wouldn't work in this case.

How can I take a numeric integer value (between -80 and 84), and get it to output the appropriate letter string?

0 Kudos
Message 5 of 6
(3,431 Views)

@KarlosAmigos wrote:

Thanks Bob,

You are right and William1225 was kind enough to put a picture up of the maths.

 

From a coding point of view, I was wanting to learn how to use maybe an array to do this. For the latitude zones in UTM format for example, these are designated by letters every 8 degrees (In Brisbane for example, I am in UTM zone 56J. Anything between latitude 24S and 32S is in J), so the math wouldn't work in this case.

How can I take a numeric integer value (between -80 and 84), and get it to output the appropriate letter string?


Do that math to convert your latitude to a zone number.  Have an array of alphabetical letters.  Do an Index Array to index out the correct letter based on the math result.

Message 6 of 6
(3,418 Views)