Hi friends i need to writing a code to use the longitue and latitude to get a time zone. Example below
Logitude Latitude
OMAN 21.9 56.6
BRGHT 27.57 -89.4
BLUGL 26.25 -91.95
latitude lines run horizontally
Longitude are vertical lines
using below example of wget we get the +0400 which is a TIMEZONE . How can we write a program to create a table and put this information in another column.
Correct me if I am wrong, so you have an XML with latitude, longitude & timezone and you want to parse this XML file and get these values and put them in table format?
If yes, from the provided XML how do you want your output data look like? It will be better if you can post a sample desired output required from the XML input.
When you do wget you get the xml format in the output . In that output i would like to take out only 1 value out of the xml file and place it in a table
If all you want to do is extract the timezone, awk '/isotime/ { sub(/<.*/,"",$3) ; print $3 }' but I suspect we could find a better solution to your whole problem here if you'd say it.
First column will not show in xml because i have taken only 2 values longitude and latitude to get the result using wget on a URL which creates an xml file on output which i pasted in the initial post.
---------- Post updated at 01:18 PM ---------- Previous update was at 12:15 PM ----------
This gives me a syntax error
a@b.com$ awk -F'[<>]' '/latitude/ {
LA=$3;
} /longitude/ {
LO=$3;
} /isotime/ {
TS=$3;
sub(/.* /,x,TS);
sub(/\[.*/,x,TS);
} END {
print LA, LO, TS;
} ' output3
awk: syntax error near line 7
awk: illegal statement near line 7
awk: syntax error near line 8
awk: illegal statement near line 8
First, you need a database of all the national spaces where tz is not normal, an hour off GMT for each 15 degree zone, starting with +/- 7.5 degrees longitude = GMT or UTC. Looking at the map, it seems more the exception than the rule, so one needs a database of all the state, province or nation political boundaries to extract those that are time zone boundaries. Since many follow rivers or coastlines, it will not be a small database, and it may be in vectors where the boundaries lie, so you need a program to decide if your lat-long is inside their multifaceted polygon. I am not into maps that deep, but I can imagine someone has some sort of app and db that does lat-long to political. Maybe the database can have a lot of lat-long "rectangular" boxes so it becomes a relative simple query. You could take a vectors of boundary database and generate even more rectangles. How fine is fine enough bubbles up very quickly as a requirement question!