Google Static MAPS API url resulting in 500 error - google-maps-api-3

I am using the google static maps API and have the following url:
http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=400x400&markers=icon:http://localhost/SimpleApp/images/SubjectIcon.png%7c44.942065,-93.66287&markers=icon:http://localhost/SimpleApp/images/BlueIcon.png%7c41.9922652,-87.7832879&markers=icon:http://localhost/SimpleApp/images/BlueIcon.png%7c44.0221363,-92.4666658
The problem is, I get a 500 error using this url. Could anyone help me see what I am missing?
TIA

The URL in your sample is looking for icons hosting locally via http://localhost which Google Maps can't find. Changing those URLs to publicly available images should work fine. As an example, the following URL works fine:
http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=400x400&markers=icon:http://upload.wikimedia.org/wikipedia/en/f/f4/Blue_icon.png%7c44.942065,-93.66287&markers=icon:http://upload.wikimedia.org/wikipedia/en/f/f4/Blue_icon.png%7c41.9922652,-87.7832879&markers=icon:http://upload.wikimedia.org/wikipedia/en/f/f4/Blue_icon.png%7c44.0221363,-92.4666658

Related

Getting 401 error in postman using NextJS in Gitpod

Thanks for looking at my issue.
I am learning NextJS, and using Gitpod to test my exercise project.
The code I wrote is just a simple API route which works when you type API route in the browser (it returns DATA in JSON as expected).
However when trying to check the API using postman (and Thunder VScode extension), I get 401 error.
I have tested similar code in Codesandbox, and it works fine using postman.
Can you please advise what am I missing?
Thanks,
This code works with browser and postman,
export default function handler(req, res){
res.status(200).json({name: 'John Doe'})
}
Possible solutions:
Change https to http in posman
Delete .next folder + re-run project
Look at your gitpod settings, maybe you have some restrictions based on your profile
Problem solved :) Thanks to Gitpod
Port should have been set to Public

Google maps API directions service redirects to JSON info, but how do I get it to open map app in phone?

I'm new to Google Map API. The following javascript opens a new page with the JSON data. The google documentation gives the following URL example, (I added the window.open javascript part). But there isn't a complete example anywhere that I found.
I'm trying to open this from my asp.net website, into open the google maps app on a phone to the places indicated. Of course, the places will be put in programmically.
function myNavFunc4(){
window.open("https://maps.googleapis.com/maps/api/directions/json?origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&key=My_KEY");
}
In order to launch Google Maps app from your website you can use the Google Maps URLs. This API was designed for this purpose.
Instead of using Directions API web service endpoint in your script you should create a Google Maps URL for directions.
E.g.
function myNavFunc4(){
window.open("https://www.google.com/maps/dir/?api=1&origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK");
}
For further details please have a look at Google Maps URLs documentation.
Enjoy.

Facing issue with signedUrl using #google-cloud/storage in firebase-cloud-functions

I want to create signedUrl of an image(saved in firebase-storage) out of its path, as we know, firebase sdk doesn't provide such functionality in firebase-cloud-functions, so i've followed the instructions given at Get Download URL from file uploaded with Cloud Functions for Firebase
I'm able to generate the url for image via cloud-function, but after opening that link in browser, receiving the following error.
<Code>MalformedSecurityHeader</Code>
<Message>Your request has a malformed header.</Message>
<ParameterName>signature</ParameterName>
<Details>Signature was not base64 encoded</Details>
Unlikely this is your problem - but I realised I was getting exactly this error because I was 'ctrl+clicking' the link in the VS code terminal - and it was only copying a partial URL into chrome. If I manually copy and paste the full URL into chrome, it was actually valid.

google maps API v3 not working with cordova

I'm trying to use the google maps on an Android app. I include the Google Maps API with
<script type="text/javascript" src="http://maps.googleapis.com/maps/api /js?key=my key&sensor=false"></script>
Every website is whitelisted with
<access origin=".*"/>
in the .xml.
But i still get an error
Uncaught referenceError:google is not defined
So, the API couldn't be loaded.
The code works perfectly when running on my PC but this happen when I put it on the mobile device, showing that the problem may come from cordova.
My device of course has an internet connection, any idea on how to fix that?
Assuming this is just a typo, but you have a space in your url, and now I believe the url is: http://maps.google.com/maps/api/js?key=yourkey&sensor=false

Correct redirect URI for Google API and OAuth 2.0

I am making an application with the Google Maps API. I want to be able to have one person on a computer, watch what another person has edited to a map. I am thinking of passing information of the map to a Google Fusion Table. The other person will be able to see everything as a layer. I would like for the program to just run from the user's browser and not build a website for it.
To edit the fusion tables, I need to gain access/tokens. I am currently trying to use these there JavaScript to accomplish this. ScriptSample.html, oauthWindow.html, and gwt-oauth2.js. This is the working example.
When I run them, I get am error that says the redirect URI is incorrect. It says the file I use to redirect does not have authority. My first obvious question is:
How do I give that file authority to redirect?
In my API console, I have it set up as a client-side web application. Should I change it to an installed application?
Currently I have the following settings:
my JavaScript origin is: https://localhost
redirect URI: https://localhost/oauthWindow.html
Thanks
There's no problem with using a localhost url for Dev work - obviously it needs to be changed when it comes to production.
You need to go here:
https://developers.google.com/accounts/docs/OAuth2
and then follow the link for the API Console - link's in the Basic Steps section. When you've filled out the new application form you'll be asked to provide a redirect Url. Put in the page you want to go to once access has been granted.
When forming the Google oAuth Url - you need to include the redirect url - it has to be an exact match or you'll have problems. It also needs to be UrlEncoded.

Resources