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

help4407


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

Assignment 2 and Clarifications.
 
Options:
RSS cloud
Jump to:

Assignment2 Q3 maps

8 of 390 articles shown, currently no other people reading this forum.
photo
From: Nathan S.
Date: Sun 17th May, 11:42am
Actions: 
        Login-to-reply
Hi Chris,

Regarding the last part of Q3, plotting the route or waypoints on a map.  After 
several hours of searching, I simply can not get google maps (in any form) to display 
markers.  The basic message from google is that you must enable billing to enable the 
API key to actually work.  That requires me to give credit card details to google.  I 
am not going to do that.  You can go through the google js api, google charts, it 
doesn't matter, for maps you need an active billing linked API key.

Do you have any suggestions?

Regards,

Nathan

Assignment2 Q3 maps

photo
From: Mingbo Z.
Date: Sun 17th May, 3:16pm
Actions: 
        Login-to-reply
You can use the google charts to show pins and map. 
https://developers.google.com/chart/interactive/docs/gallery/map

Assignment2 Q3 maps

photo
From: David M.
Date: Sun 17th May, 4:45pm
Actions: 
        Login-to-reply
Google Charts states: "The Google Map Chart displays a map using the Google Maps API."

Google Maps documentation states: : "Before you can start using the Google Maps Platform APIs and SDKs, you must sign up and create a billing account."

There is free alternative "OpenStreetMap" <https://www.openstreetmap.org> but I have not
tried it.

Assignment2 Q3 maps

photo
From: Nathan S.  O.P.
Date: Mon 18th May, 9:42am
Actions: 
        Login-to-reply
"Mingbo Zhang"                               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:
https://developers.google.com/chart/interactive/docs/gallery/map#fullhtml

You will see the nasty little line of code like this:
-------------------------------------------------------------------
        // Note: you will need to get a mapsApiKey for your project.
        // See: 
https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings
        "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;}' 
infile
--------------------------------------------
=> 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 
command
=> '$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 
line    

---------------------------------------------
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

Assignment2 Q3 maps

photo
From: Mingbo Z.
Date: Mon 18th May, 3:20pm
Actions: 
        Login-to-reply
Thank you for telling me this. I just knew google will charge us for using thier map API. 
Well, it sucks. I saw another map web David mentioned in this topic and found a guide to 
use it. I am not sure it would work or not. https://www.linux.com/news/displaying-maps-
openlayers/

Assignment2 Q3 maps

photo
From: Christopher M.
Date: Mon 18th May, 3:24pm
Actions: 
        Login-to-reply
"Mingbo Zhang"                               wrote:

> Thank you for telling me this. I just knew google will charge us for using thier map API. 
> Well, it sucks. I saw another map web David mentioned in this topic and found a guide to 
> use it. I am not sure it would work or not. https://www.linux.com/news/displaying-maps-
> openlayers/


I'm looking into this;  I (must) have an old Google Maps account, which was free at the time.  Did 
not appreciate that they had started charging for it.  I believe that the monthly free allowance is 
sufficient for the set task,  but appreciate that some will not want to sign up for anything.  That's 
OK.

I'll likely alter the question (soon).

Assignment2 Q3 maps

photo
From: Nathan S.  O.P.
Date: Wed 20th May, 10:48am
Actions: 
        Login-to-reply
"Christopher McDonald" <chris.                     wrote:

> "Mingbo Zhang"                               wrote:
> 
> > Thank you for telling me this. I just knew google will charge us for using thier map API. 
> > Well, it sucks. I saw another map web David mentioned in this topic and found a guide to 
> > use it. I am not sure it would work or not. https://www.linux.com/news/displaying-maps-
> > openlayers/
> 
> 
> I'm looking into this;  I (must) have an old Google Maps account, which was free at the time.  Did 
> not appreciate that they had started charging for it.  I believe that the monthly free allowance is 
> sufficient for the set task,  but appreciate that some will not want to sign up for anything.  That's 
> OK.
> 
> I'll likely alter the question (soon).

My guess is you had some billing account with them.
FYI...
I had my credit card details with google last year, I think I bought something online and I had to add it 
to my google account, then a couple of months later, I got some fraudulent charges through google for 
gaming (I don't even play online games).  I do not know if it was related to google having my credit card 
details or some other online purchase, but the result was that I had to get a new card from the bank and 
that was a bit of a hassle changing the details with all the companies that I have it registered with eg. 
gym, power, water, internet etc.  So, basically after that experience, as well as doing the cloud 
computing unit last year and seeing how much you could get charged with cloud providers if you 
accidentally launched some bare metal high end compute instances or something, I  would rather use 
amazon/google cloud withh someone else's credit card, not mine.  If I was going to sign up again, I would 
probably use a separate card and just put a hard daily/monthly spending limit on it.  I acknowledge that I 
am probably being paranoid and those fraudulent charges probably were not as a result of my details being 
with google, I just do not have enough information.

Assignment2 Q3 maps

photo
From: Christopher M.
Date: Fri 22nd May, 7:35am
Actions: 
        Login-to-reply
"Nathan Scott"                               wrote:

> I had my credit card details with google last year, I think I bought something online and I had to add it 
> to my google account, then a couple of months later, I got some fraudulent charges through google for 
> .....
> that was a bit of a hassle changing the details with all the companies that I have it registered with eg. 
> gym, power, water, internet etc.  So, basically after that experience, as well as doing the cloud 


Ditto;  while in the US for 6 months last year, my Australian credit card kept hiring rental cars in Florida (while I 
was in New Hampshire);  a challenge to convince my Australian bank of things that didn't happen.

The requirement to produce a Google Map of your trip has been removed.
Please see the Clarifications.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020