Sponsored Content
Top Forums UNIX for Beginners Questions & Answers awk scripting to select a rectangle frame Post 303044235 by wisecracker on Monday 17th of February 2020 05:53:12 AM
Old 02-17-2020
Hi jeo_fb...

Assuming you are using Longitude and Latitude WRT Earth as a __sphere__ then it is not possible to create a rectangle as Euclidean geometry does not apply.

IF, however you just want the Longitude to change but have matching Latitudes and vice versa and those listing out then please confirm...

Bazza...

Last edited by wisecracker; 02-17-2020 at 07:01 AM.. Reason: Add the words "and vice versa"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED scripting select

Say I have a file 'example.txt' with these lines of code in it: hello:anddasd:cheese:gerg whatever:sdadsa:asdfasdfa:wwew hmmmm:something:gfhfhgf:sdasdas Question: 1. How would I write a script which is able to take all the words before the first ':'? 2. How would I write a script which is... (6 Replies)
Discussion started by: i_am_a_robot
6 Replies

2. UNIX for Dummies Questions & Answers

Awk - select from a list

Hi all, I am trying to select some columns from a file, based on the list of values. Would like to know how best I can achive this. If coulmn 1 has a value of 57 then print the ist column (This works) awk -F' ' '{if ( $1 == 57 ) {print $1}}' file.txt Now my requirement is that I have to... (14 Replies)
Discussion started by: simha77777
14 Replies

3. Shell Programming and Scripting

SQL Select and awk

Dear All , I have file1.txt contain values like the following: ---------- 23 24 25 and I have shell script which has the following : more file1.txt | awk '{print "select 'DUMP',CODE1||'|'||CODE2||'|'||CODE3 from CODE where CODE1='" $1 "';"}' > file2.sql all I need is to have the... (6 Replies)
Discussion started by: habuzahra
6 Replies

4. Shell Programming and Scripting

Removing repeating lines from a data frame (AWK)

Hey Guys! I have written a code which combines lots of files into one big file(.csv). However, each of the original files had headers on the first line, and now that I've combined the files the headers are interspersed throughout the new combined data frame. For example, throughout the data... (21 Replies)
Discussion started by: gd9629
21 Replies

5. Shell Programming and Scripting

awk with fields select?

If i have a log file record.txt, with 10 fields - First field is datetime - 7th field is status - 8th filed is name - The last field (10th) is epoch time of the first field 02/17/2012 1:47 PM||||||In Use|chicken||1329515230 02/17/2012 2:53 PM||||||Available|chicken||1329519195 02/17/2012... (4 Replies)
Discussion started by: sabercats
4 Replies

6. Shell Programming and Scripting

awk : Search for text between two time frame (12 hours)

I have created the script to grep the errors from weblogic logs files and redirecting output to file.txt ...From file.txt I'm using awk command to collect the past 20 mins output...The script running from cron every 15 mins... The script working well... Now the challenges, I'm trying to use... (27 Replies)
Discussion started by: zenkarthi
27 Replies

7. Shell Programming and Scripting

awk : collecting all data between two time frame

Hi Experts , I need your help to collect the complete data between two time frame from the log files, when I try awk it's collecting the data only which is printed with time stamp for example, awk works well from "16:00 to 17:30" but its not collecting <line*> "from 17:30 to 18:00" ... (8 Replies)
Discussion started by: zenkarthi
8 Replies

8. Shell Programming and Scripting

Using awk to select one field

Hi, I saw your post.. I have a dought in awk command... how to get the output from a file. i need a first column in etc/passwd file in a single column (in indivijual line)... i couldn't get with this command cat /etc/passwd | awk -F ":" '{printf $1}' Kindly help This thread was created... (3 Replies)
Discussion started by: Dheepak s
3 Replies

9. UNIX and Linux Applications

Rectangle is flickering while dragging on screen with xlib

Hi, this is my first post here. I wanto make a screencasting program. I want to make a screen part selection to grab coordinates of the screen location. I found a nice prototype #include <X11/Xlib.h> //#include <X11/Xresource.h> #include <stdlib.h> #include <stdio.h> #include... (0 Replies)
Discussion started by: whatnext
0 Replies

10. Shell Programming and Scripting

Shell Scripting - Select multiple files from numbered list

I am trying to have the user select two files from a numbered list which will eventually be turned into a variable then combined. This is probably something simple and stupid that I am doing. clear echo "Please Select the Show interface status file" select FILE1 in *; echo "Please Select the... (3 Replies)
Discussion started by: dis0wned
3 Replies
UTM(3pm)						User Contributed Perl Documentation						  UTM(3pm)

NAME
Geo::Coordinates::UTM - Perl extension for Latitiude Longitude conversions. SYNOPSIS
use Geo::Coordinates::UTM; my ($zone,$easting,$northing)=latlon_to_utm($ellipsoid,$latitude,$longitude); my ($latitude,$longitude)=utm_to_latlon($ellipsoid,$zone,$easting,$northing); my ($zone,$easting,$northing)=mgrs_to_utm($mgrs); my ($latitude,$longitude)=mgrs_to_latlon($ellipsoid,$mgrs); my ($mgrs)=utm_to_mgrs($zone,$easting,$northing); my ($mgrs)=latlon_to_mgrs($ellipsoid,$latitude,$longitude); my @ellipsoids=ellipsoid_names; my($name, $r, $sqecc) = ellipsoid_info 'WGS-84'; DESCRIPTION
This module will translate latitude longitude coordinates to Universal Transverse Mercator(UTM) coordinates and vice versa. Mercator Projection The Mercator projection was first invented to help mariners. They needed to be able to take a course and know the distance traveled, and draw a line on the map which showed the day's journey. In order to do this, Mercator invented a projection which preserved length, by projecting the earth's surface onto a cylinder, sharing the same axis as the earth itself. This caused all Latitude and Longitude lines to intersect at a 90 degree angle, thereby negating the problem that longitude lines get closer together at the poles. Transverse Mercator Projection A Transverse Mercator projection takes the cylinder and turns it on its side. Now the cylinder's axis passes through the equator, and it can be rotated to line up with the area of interest. Many countries use Transverse Mercator for their grid systems. Universal Transverse Mercator The Universal Transverse Mercator(UTM) system sets up a universal world wide system for mapping. The Transverse Mercator projection is used, with the cylinder in 60 positions. This creates 60 zones around the world. Positions are measured using Eastings and Northings, measured in meters, instead of Latitude and Longitude. Eastings start at 500,000 on the centre line of each zone. In the Northern Hemisphere, Northings are zero at the equator and increase northward. In the Southern Hemisphere, Northings start at 10 million at the equator, and decrease southward. You must know which hemisphere and zone you are in to interpret your location globally. Distortion of scale, distance, direction and area increase away from the central meridian. UTM projection is used to define horizontal positions world-wide by dividing the surface of the Earth into 6 degree zones, each mapped by the Transverse Mercator projection with a central meridian in the center of the zone. UTM zone numbers designate 6 degree longitudinal strips extending from 80 degrees South latitude to 84 degrees North latitude. UTM zone characters designate 8 degree zones extending north and south from the equator. Eastings are measured from the central meridian (with a 500 km false easting to insure positive coordinates). Northings are measured from the equator (with a 10,000 km false northing for positions south of the equator). UTM is applied separately to the Northern and Southern Hemisphere, thus within a single UTM zone, a single X / Y pair of values will occur in both the Northern and Southern Hemisphere. To eliminate this confusion, and to speed location of points, a UTM zone is sometimes subdivided into 20 zones of Latitude. These grids can be further subdivided into 100,000 meter grid squares with double-letter designations. This subdivision by Latitude and further division into grid squares is generally referred to as the Military Grid Reference System (MGRS). The unit of measurement of UTM is always meters and the zones are numbered from 1 to 60 eastward, beginning at the 180th meridian. The scale distortion in a north-south direction parallel to the central meridian (CM) is constant However, the scale distortion increases either direction away from the CM. To equalize the distortion of the map across the UTM zone, a scale factor of 0.9996 is applied to all distance measurements within the zone. The distortion at the zone boundary, 3 degrees away from the CM is approximately 1%. Datums and Ellipsoids Unlike local surveys, which treat the Earth as a plane, the precise determination of the latitude and longitude of points over a broad area must take into account the actual shape of the Earth. To achieve the precision necessary for accurate location, the Earth cannot be assumed to be a sphere. Rather, the Earth's shape more closely approximates an ellipsoid (oblate spheroid): flattened at the poles and bulging at the Equator. Thus the Earth's shape, when cut through its polar axis, approximates an ellipse. A "Datum" is a standard representation of shape and offset for coordinates, which includes an ellipsoid and an origin. You must consider the Datum when working with geospatial data, since data with two different Datum will not line up. The difference can be as much as a kilometer! EXAMPLES
A description of the available ellipsoids and sample usage of the conversion routines follows Ellipsoids The Ellipsoids available are as follows: 1 Airy 2 Australian National 3 Bessel 1841 4 Bessel 1841 (Nambia) 5 Clarke 1866 6 Clarke 1880 7 Everest 1830 (India) 8 Fischer 1960 (Mercury) 9 Fischer 1968 10 GRS 1967 11 GRS 1980 12 Helmert 1906 13 Hough 14 International 15 Krassovsky 16 Modified Airy 17 Modified Everest 18 Modified Fischer 1960 19 South American 1969 20 WGS 60 21 WGS 66 22 WGS-72 23 WGS-84 24 Everest 1830 (Malaysia) 25 Everest 1956 (India) 26 Everest 1964 (Malaysia and Singapore) 27 Everest 1969 (Malaysia) 28 Everest (Pakistan) 29 Indonesian 1974 ellipsoid_names The ellipsoids can be accessed using ellipsoid_names. To store thes into an array you could use my @names = ellipsoid_names; ellipsoid_info Ellipsoids may be called either by name, or number. To return the ellipsoid information, ( "official" name, equator radius and square eccentricity) you can use ellipsoid_info and specify a name. The specified name can be numeric (for compatibility reasons) or a more-or- less exact name. Any text between parentheses will be ignored. my($name, $r, $sqecc) = ellipsoid_info 'wgs84'; my($name, $r, $sqecc) = ellipsoid_info 'WGS 84'; my($name, $r, $sqecc) = ellipsoid_info 'WGS-84'; my($name, $r, $sqecc) = ellipsoid_info 'WGS-84 (new specs)'; my($name, $r, $sqecc) = ellipsoid_info 23; latlon_to_utm Latitude values in the southern hemisphere should be supplied as negative values (e.g. 30 deg South will be -30). Similarly Longitude values West of the meridian should also be supplied as negative values. Both latitude and longitude should not be entered as deg,min,sec but as their decimal equivalent, e.g. 30 deg 12 min 22.432 sec should be entered as 30.2062311 The ellipsoid value should correspond to one of the numbers above, e.g. to use WGS-84, the ellipsoid value should be 23 For latitude 57deg 49min 59.000sec North longitude 02deg 47min 20.226sec West using Clarke 1866 (Ellipsoid 5) ($zone,$east,$north)=latlon_to_utm('clarke 1866',57.803055556,-2.788951667) returns $zone = 30V $east = 512543.777159849 $north = 6406592.20049111 latlon_to_utm_force_zone On occasions, it is necessary to map a pair of (latitude, longitude) coordinates to a predefined zone. This function allows to select the projection zone as follows: ($zone, $east, $north)=latlon_to_utm('international', $zone_number, $latitude, $longitude) For instance, Spain territory goes over zones 29, 30 and 31 but sometimes it is convenient to use the projection corresponding to zone 30 for all the country. Santiago de Compostela is at 42deg 52min 57.06sec North, 8deg 32min 28.70sec West ($zone, $east, $norh)=latlon_to_utm('international', 42.882517, -8.541306) returns $zone = 29T $east = 537460.331 $north = 4747955.991 but forcing the conversion to zone 30: ($zone, $east, $norh)=latlon_to_utm_force_zone('international', 30, 42.882517, -8.541306) returns $zone = 30T $east = 47404.442 $north = 4762771.704 utm_to_latlon Reversing the above example, ($latitude,$longitude)=utm_to_latlon(5,'30V',512543.777159849,6406592.20049111) returns $latitude = 57.8030555601332 $longitude = -2.7889516669741 which equates to latitude 57deg 49min 59.000sec North longitude 02deg 47min 20.226sec West latlon_to_mgrs Latitude values in the southern hemisphere should be supplied as negative values (e.g. 30 deg South will be -30). Similarly Longitude values West of the meridian should also be supplied as negative values. Both latitude and longitude should not be entered as deg,min,sec but as their decimal equivalent, e.g. 30 deg 12 min 22.432 sec should be entered as 30.2062311 The ellipsoid value should correspond to one of the numbers above, e.g. to use WGS-84, the ellipsoid value should be 23 For latitude 57deg 49min 59.000sec North longitude 02deg 47min 20.226sec West using WGS84 (Ellipsoid 23) ($mgrs)=latlon_to_mgrs(23,57.8030590197684,-2.788956799) returns $mgrs = 30VWK1254306804 mgrs_to_latlon Reversing the above example, ($latitude,$longitude)=mgrs_to_latlon(23,'30VWK1254306804') returns $latitude = 57.8030590197684 $longitude = -2.788956799645 mgrs_to_utm Similarly it is possible to convert MGRS directly to UTM ($zone,$easting,$northing)=mgrs_to_utm('30VWK1254306804') returns $zone = 30V $easting = 512543 $northing = 6406804 utm_to_mgrs and the inverse converting from UTM yo MGRS is done as follows ($mgrs)=utm_to_mgrs('30V',512543,6406804); returns $mgrs = 30VWK1254306804 AUTHOR
Graham Crookham, grahamc@cpan.org THANKS
Thanks go to the following: Felipe Mendonca Pimenta for helping out with the Southern hemisphere testing. Michael Slater for discovering the Escape Q bug. Mark Overmeer for the ellipsoid_info routines and code review. Lok Yan for the >72deg. N bug. Salvador Fandino for the forced zone UTM and additional tests Matthias Lendholt for modifications to MGRS calculations Peder Stray for the short MGRS patch COPYRIGHT
Copyright (c) 2000,2002,2004,2007,2010 by Graham Crookham. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-06-13 UTM(3pm)
All times are GMT -4. The time now is 07:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy