From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Latitude & Longitude string to number through type cast

In my application i am saving the data ( 78°20.54 E )coming from gps in tdms format in the pc.

 

There are many such strings to save , so as this takes more memory to save the data in pc i want to type case in floating  and save .

 

I am typecasting But i am not able to retrive the same data 78°20.54 E while again type casting .

 

Please see the attached vi.

 

Regards

Naga

0 Kudos
Message 1 of 47
(3,577 Views)

Take a look at the string palette, specifically:

 

Format into string

Scan from string

0 Kudos
Message 2 of 47
(3,562 Views)

You can't simply typecast a string like "78°20.54 E" directly to a floating point number. That makes no sense. What is the degree symbol supposed to be type-cast to? What is the space supposed to be typecast to?

 

If your intent is to reduce the space storage requirement, then you need to convert the string to an appropriate coordinate system. I would suggest doing some reading on latitude/longitude coordinate systems.

0 Kudos
Message 3 of 47
(3,546 Views)

@smercurio_fc wrote:

You can't simply typecast a string like "78°20.54 E" directly to a floating point number. That makes no sense. What is the degree symbol supposed to be type-cast to? What is the space supposed to be typecast to?

 

If your intent is to reduce the space storage requirement, then you need to convert the string to an appropriate coordinate system. I would suggest doing some reading on latitude/longitude coordinate systems.


I don't see any need to change the coordinate system. What would he gain? All he has to do is convert the lat/long values to decimal degrees and store.

0 Kudos
Message 4 of 47
(3,538 Views)

@Spruce wrote:

@smercurio_fc wrote:

You can't simply typecast a string like "78°20.54 E" directly to a floating point number. That makes no sense. What is the degree symbol supposed to be type-cast to? What is the space supposed to be typecast to?

 

If your intent is to reduce the space storage requirement, then you need to convert the string to an appropriate coordinate system. I would suggest doing some reading on latitude/longitude coordinate systems.


I don't see any need to change the coordinate system. What would he gain? All he has to do is convert the lat/long values to decimal degrees and store.


I was referring to something that did not involve characters like a degree symbol, spaces, and N, S, E, W. In other words, something completely numeric. Perhaps conveting to decimal degrees is sufficient. I don't know. The question posted by the user was why it didn't work. And the answer is that it makes no sense to try what the user was trying to do in the first place.

0 Kudos
Message 5 of 47
(3,530 Views)

@smercurio_fc wrote:

I was referring to something that did not involve characters like a degree symbol, spaces, and N, S, E, W. In other words, something completely numeric. Perhaps conveting to decimal degrees is sufficient. I don't know. The question posted by the user was why it didn't work. And the answer is that it makes no sense to try what the user was trying to do in the first place.


 

Actually, his question was how to convert the string representation to floating point and back again.

 

0 Kudos
Message 6 of 47
(3,515 Views)

Re-read the question.

0 Kudos
Message 7 of 47
(3,511 Views)

Nagaa,

 

You might want to better explain exactly what you want.

 

Do you want "78°20.54" to be 78.3423 (I'm assuming after the ° is minutes)?  Then have E be positive and W be negative?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 47
(3,509 Views)

Hello every one 

 

I just want to convert the strings like  78°20.54 E to some floating point and save this in pc so that i can save file memory . and retrive again the same value  ( 78°20.54 E ) to represent in the report generation

0 Kudos
Message 9 of 47
(3,487 Views)

@smercurio_fc wrote:

Re-read the question.


I did. He's still asking how to convert the string to float and back again.

0 Kudos
Message 10 of 47
(3,466 Views)