Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).
RSS cloud
Jump to:

Assignment2 Q3 maps

1 of 390 articles shown, currently no other people reading this forum.
From: Nathan S.  O.P.
Date: Mon 18th May, 9:42am


"Mingbo Zhang" <22*9*0*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> You can use the google charts to show pins and map. 
> https://developers.google.com/chart/interactive/docs/gallery/map

Yes Mingbo, if you dig a little deeper, click on the "full html" in that page, here:

You will see the nasty little line of code like this:
        // Note: you will need to get a mapsApiKey for your project.
        // See: 
        "mapsApiKey": "AIzaSyD-9tSrke72PouQMnMX-a7eZSW0jkFMBWY"

This means you are out of luck.  You go an register with google, get an api key and 
it won't work wihtout a billing account.  Please go ahead and try it and report if 
you actually get it working without a billing account.  I tried it already and it 
don't work.  I'm not giving google my credit card details.

So my question still stands.  I think Chris will most likely change the requirement 
if we can't get an acceptable solution.  Regarding David's suggestion, yes maybe, 
but seriously I have slaved over a hot computer for 5 days getting this thing done, 
trying to fill in the gaps on sed and awk, the last thing I want to be doing at this 
point is messing around with google cloud billing issues or unknown 3rd party 
mapping apps that are unproven, it is not related to the course.

While I am ranting, here is my summary of some useful commands, maybe it can help 
someone out there.  I do not think we spent enough time on awk in the unit and had 
to fill in some serious gaps in my understanding (or maybe I just don't listen 
carefully enough to the lectures!?), I still do not understand awk much, but these 
things came in super useful:

1) awk seems to use some basic form of regex, doesn't support look aheads and things 
like that, but the good thing is that what you can't do with the regex selector, you 
can fall back to if statements in the {...} section.  So it can cover most 
scenarios.  I was about to give up on awk until I worked this out.

2) awk -F'[abc]' -v var=$some_var '$3~/some regex/   {print $5 "," $3/1000;next;}' 
=> here -F'[abc]'  ... will break up each line with any of the delimiters in the 
regex expression [abc], i.e. a or b or c in this case
=> -v var=$some_var  ....    will bring in an external bash variable to your awk 
=> '$3~/some regex/    ....    this applies the regex pattern /some regex/ only to 
column 3 based on the delimiters described above
=> print $5/1000 "," $3   .... this will print the columns in any order you want and 
apply a mathematical operation to them if you want.  that can help to autoformat non 
numeric content to 0 etc.
=> next;   ....   will not process any other regex matches and just skip to the next 

3) join => bash command, kind of like sql inner join, you can match 2 files by a 
common key, default behaviour, it will only include the matched rows

4) paste  => maybe not so relevant, this is a bash command, you can join multiple 
files row wise

Related articles

Assignment2 Q3 maps (all 8) RSS
├─ original   Sun 17th May, 11:42am, Nathan S.
├─ reply 1   Sun 17th May, 3:16pm, Mingbo Z.
├─ reply 2   Sun 17th May, 4:45pm, David M.
├─ THIS   Mon 18th May, 9:42am, Nathan S.  O.P.
├─ reply 4   Mon 18th May, 3:20pm, Mingbo Z.
├─ reply 5   Mon 18th May, 3:24pm, Christopher M.
├─ reply 6   Wed 20th May, 10:48am, Nathan S.  O.P.
└─ reply 7   Fri 22nd May, 7:35am, Christopher M.
This Page

Program written by: [email protected]
Feedback welcome
Last modified:  3:57pm Aug 06 2020