473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Changing Lattitude and longitude specficness

I have latitudes and longitudes in the form 45.56N or 3.30S and I wish to round them to 46N and 3S respectively. I would love a calculated field or macro to do this as I have a large data set. Thank you.
May 18 '16 #1
2 806
PhilOfWalton
1,430 Expert 1GB
Try

Expand|Select|Wrap|Line Numbers
  1. CStr(Round(Val(LatLong), 0)) & right(LatLong, 1)
  2.  
Val(LatLong) gets the numeric part of the Lat / Long
Round removes the decimals
Then convert it back to a string and add the N,S.E or W.
Be aware that your rounding error could represent a distance of up to 45 miles.

Phil
May 18 '16 #2
ADezii
8,834 Expert 8TB
  1. Function Definition:
    Expand|Select|Wrap|Line Numbers
    1. Public Function fRoundLatLong(strLatLong As String) As String
    2.   fRoundLatLong = CStr(Fix(Val(strLatLong))) & Right(strLatLong, 1)
    3. End Function
  2. Sample Call 1 & Result:
    Expand|Select|Wrap|Line Numbers
    1. Debug.Print fRoundLatLong("45.56N")
    2. 45N
  3. Sample Call 2 & Result:
    Expand|Select|Wrap|Line Numbers
    1. Debug.Print fRoundLatLong("3.30S")
    2. 3S
May 18 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jack | last post by:
not sure exactly where I should ask this question, but im looking for a database of Australian Postcodes that included the longitude/latitude. Does anyone know of such a thing? Preferably...
4
by: YS Sze | last post by:
If you know the exact longitude and latitude for a specific location, would anyone think it'd make any sense to find out if this set of location numbers is really part of the Fibonacci series or...
2
by: kbperry | last post by:
I am not sure if this is the right place for this, but I thought it was worth a shot. What I want: Enter a From: street address and a To: street address, and then specify an interval (say...
6
by: helpneeded | last post by:
Hi I am a novice using the <maptag. I have a question. I would really appreciate if you could answer me. I want to use the <maptag to dynamically update my map with coordinates. These...
10
by: Joseph Geretz | last post by:
I need to calculate miles per degree longitude, which obviously depends on latitude since lines of longitude converge at the poles. Via Google, I've come up with the following calculation: ...
1
by: Abdullah Kamran | last post by:
I have found a method to find the timezone using longitude of a place from somewhere. I tried it to do some calculations and found it working, it is not very accurate though (needs some improvements)...
1
by: ttamilvanan81 | last post by:
Hai everyone, I need to find the Latitude and Longitude values for any one of the Particular location from the Google Maps, using pure java class. I know, it's done by using javascript, but i...
5
by: arial | last post by:
Hi all, I have a sql .bak file which i need to convert into xml file. can someone help with this? pointing out to some tutorial or some suggetion on how to start? Thak you,
1
by: alan5 | last post by:
I want to answer on the topic australian postcode db with longitude/latitude posted by jack. He wrote: not sure exactly where I should ask this question, but im looking for a database of...
1
omerbutt
by: omerbutt | last post by:
hi i am trying to store the longitude and latitude i have made the table with 3 columns codes, longitude , latitude and the type for longitude and latitude is decimal(15,11) but there are different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.