Jump to content

geolocation null


mbpowner

Recommended Posts

I don't see those messages, I see lat and long are undefined.  That's probably because the callback won't get called if the user doesn't share their location.  You need to check if those variables are defined before trying to do something with them.  You can go that Google URL if you want to see information about the error message from them.

Link to comment
Share on other sites

Ahh I managed to see the issue was that, for some reason, you need to have a UserCoords object in order to be visible the latitude & longitude globally instead of setting long and lat variables, the variables will be undefined but using an object it works for some odd reason... 

Anyhow, managed to resolve hte null llocation issue. Other issue is the map won't load. If you click on the settings on the javascript you can see that this is my script src that i have used:

https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false

 

not sure why this isn't working... it used to work

i'm also not sure why my JSON data isn't working ?

Link to comment
Share on other sites

If you're talking about openweathermap.org, my browser's console tells me it's because it's an insecure response.  That probably means the page was loaded over HTTPS but it's trying to send a request to HTTP and the browser is blocking it.

Link to comment
Share on other sites

9 hours ago, justsomeguy said:

If you're talking about openweathermap.org, my browser's console tells me it's because it's an insecure response.  That probably means the page was loaded over HTTPS but it's trying to send a request to HTTP and the browser is blocking it.

I figured it was to do with me using the wrong API key.  i kinda tried to use an open api key out there, but that failed. that must be something to do with secureness, i suppoe. something has changed lately. but anyways it worked when i created my own api key.

 

anyhow, still working on the google maps... they're just warnings regarding the api key, and was working fine before for sure. now i'm just not sure why it's showing a blue sky instead of land. also my location seems to be showing zagreb, when i'm actually in england. i think this is due to the inaccuracy of the api. i tried using the coordinates and they showed the right place with google... so the coordinates are right... but the sky is, for some reason, displayed on the map. whereas on the google maps website these coordinates display my universtiy

Edited by mbpowner
Link to comment
Share on other sites

By means of further experiment, I found that the api key does not matter. i tried entering the values of the coordinates directly for google maps to display. it works then.

 

however, it just seems to be an issue when using the objects UserCoords.lat and UserCoords.lng in the google.maps.latlng(UserCoords.lat,UserCoords.lng) object... what data types does the latlng take and how do i transfer it?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...