Тёмный

Get User Location in React Using HTML and Google Maps APIs 

TG Tech
Подписаться 435
Просмотров 34 тыс.
50% 1

Resources:
- HTML Geolocation: www.w3schools.com/html/html5_...
- Google Maps Reverse Geocoding: developers-dot-devsite-v2-pro...
- Get a Google Maps API Key: cloud.google.com/maps-platform/

Опубликовано:

 

27 сен 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 75   
@AstrikoM1
@AstrikoM1 4 года назад
Thanks. Amazing video!
@chrisbell7372
@chrisbell7372 4 года назад
Great video. How do i get this to work with a dynamic map rather than a static one
@freezylife
@freezylife 3 года назад
Osm Dude thankx...
@monikabhardwaj9810
@monikabhardwaj9810 4 года назад
Thankyou for making it this easy.
@mazerat3122
@mazerat3122 4 года назад
How is it working for you guys? Chrome denies geolocation permissions on anything other than HTTPS. Its not working for me. Update: Nvm, if you are having the same trouble as me you must click on the button to the left of the url (Not the crosshair one to the right of the url) And it will ask you to allow or disallow permission
@mackynikat8833
@mackynikat8833 3 года назад
. the way you speak really makes me think Steve griffith is your dad
@monsieurm2904
@monsieurm2904 3 года назад
Thank you very much for your awesome help ! I ask myself just how i can change the "big red point" in own soft geolocalisation indicator ? :) There is an option in the Google API ? Thank you for answer
@basicfunda-dynamics3652
@basicfunda-dynamics3652 Год назад
Thanks alot. It is very helpful but could you please guide me how to achieve same functionality with functional based component?
@diliru2762
@diliru2762 3 года назад
hey where do you get that image src can you please put that here?
@lararawf6100
@lararawf6100 2 года назад
God bless you
@nipadas5222
@nipadas5222 3 года назад
How can I get user geolocation or coordinates offline? can you help me with it
@kangzzing
@kangzzing 4 года назад
i'll watch this again
@bhushanbadhe7773
@bhushanbadhe7773 2 года назад
How to fetch address provided in textfiled to react bingmaps?
@sahildudani4658
@sahildudani4658 2 года назад
Hey sir I got an error in Google API key so how to solve this issue is saying that it's not defined
@mackynikat8833
@mackynikat8833 3 года назад
. pls why my this.state lat and lng looks like strings , theyre not highlitened according to thier distict colors . also when using backticks varialblies are not set with url
@vamsikrishna1297
@vamsikrishna1297 9 месяцев назад
Will it be possible to change the location from the map
@karthysbk6935
@karthysbk6935 4 года назад
response.json() Not showing results why? Help me here
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
please help me developer , not come address and map............where you find formatted_address
@anmolrox60
@anmolrox60 3 года назад
dude give the link bro are we supposed to copy, just paste in the description
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
please help me ..i follow your code but not come in map and addreessss
@lahcenechel1855
@lahcenechel1855 2 года назад
thank you bro. how to track the user in real time.
@premgohil2235
@premgohil2235 2 года назад
Help me to get location of near police in our area and get there Mobile number . Can this be done ??
@roelanehlakametsa7453
@roelanehlakametsa7453 4 года назад
Thanks this great work. what will config.js contain hance you did import it as part of obtaining reverse Gecoding Address? I think congig.js file can really help. thanks
@tgtech7074
@tgtech7074 4 года назад
Hey Roelane, good question! I'm simply importing my Google Maps API key since I didn't want it to be public in the video. In the config.js file, I have: export const GOOGLE_API_KEY = ' ' with my key within the quotes. It's best practice to keep the key private and put config.js in the .gitignore file, but you don't need to for testing...you can just put your key directly in the API call instead of ${GOOGLE_API_KEY}. Hopefully that makes sense.
@roelanehlakametsa7453
@roelanehlakametsa7453 4 года назад
@@tgtech7074 I am happy this is great answer thanks so much
@TheAlexisThink
@TheAlexisThink 4 года назад
Im trying the same of you but when i tried to get the coordinates, i see the permisson but when i agree does not work. I cant see the position object in console. Can you update o share your demo (repo)
@tgtech7074
@tgtech7074 4 года назад
Hey Alexis, sorry it’s not working for you. I’ll create a github repo for you and others to check out and post here when it’s done.
@TheAlexisThink
@TheAlexisThink 4 года назад
Taylor Griffith Hi! I search this issue and I discover the problem, it’s the permissions, on desktop works on chrome because for default ask the permission but when I tried on mobile don’t allow and the prompt for permission don’t appear... Yo have some ideas to solve this problem?
@user-uf1xy1dc9f
@user-uf1xy1dc9f 4 года назад
thank you for amazing video , can you tell me the url and the map dos not appear in may page
@tgtech7074
@tgtech7074 4 года назад
Sounds like you'll need to troubleshoot your API implementation.
@devgabriel6898
@devgabriel6898 4 года назад
Why is the Html geolocate Api not giving me my exact position? It is placing me like 600mt away from my position
@tgtech7074
@tgtech7074 4 года назад
Dev GSoft Good question. I don’t know for sure, but here’s some possible reasons: www.storelocatorwidgets.com/blogpost/20453/Everything_you_ever_wanted_to_know_about_HTML5_Geolocation_Accuracy
@parasdua1466
@parasdua1466 3 года назад
can i find location of nearby gyms with the help of this? plz reply this is very helpful thanks!!
@tgtech7074
@tgtech7074 3 года назад
I’m sure you can. Take a look at the docs and there may be a parameter or something you can pass into the url string.
@parasdua1466
@parasdua1466 3 года назад
@@tgtech7074 please tell me how to get the GOOGLE MAP API KEY??? And tell me what you exactly import
@parasdua1466
@parasdua1466 3 года назад
@@tgtech7074 please tell me it's urgent we have to include this in our project...🙏🏻
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
formatted_address where you find this
@ellisdee2013
@ellisdee2013 3 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-U3dLjHN0UvM.html
@snehasinha9147
@snehasinha9147 2 года назад
what about the config file what is there in that file its imported but not demonstrated what we have to do there
@tgtech7074
@tgtech7074 2 года назад
That just holds the Google API key. Ideally you’d have a more secure way of accessing the key for the api call.
@fanuelguill
@fanuelguill 3 года назад
First of all thanks for this. Please why am i getting a 403 error when trying to display image of my current position ?
@fanuelguill
@fanuelguill 3 года назад
Please i need an answer @TaylorGriffith
@tgtech7074
@tgtech7074 3 года назад
FG -69 thats probably an issue with your api key implementation. Double check that you have the key being passed in correctly
@zshanal3870
@zshanal3870 4 года назад
what is written in config.js????do share it
@tgtech7074
@tgtech7074 4 года назад
z!shan al! It’s GOOGLE_API_KEY= and then paste your api key. Or remove that and put the key directly in the url for the api call (but that’s more of a security risk if used in production)
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
TypeError: Cannot read property 'formatted_address' of undefined
@tgtech7074
@tgtech7074 4 года назад
Md Nazmul Hossain Check what the api call is returning through a console log or in the network tab in chrome. You’re likely not getting a successful response so it’s undefined.
@zishan745
@zishan745 4 года назад
SyntaxError:Unexpected token < in JSON at position 0
@tgtech7074
@tgtech7074 4 года назад
zishan745 I think that usually means you aren’t doing json.parse() on the result.
@rb4754
@rb4754 4 года назад
can you do this on react js please
@tgtech7074
@tgtech7074 4 года назад
Hey Rajat, this is built in React.js. I used Create React App and went from there.
@rb4754
@rb4754 4 года назад
@@tgtech7074 yes it is. I am sorry I don't know why I asked such a stupid question.
@tgtech7074
@tgtech7074 4 года назад
rajat butola no problem! :)
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
please help me .............i am try again and again but can't coming map and addresses. please help me ...........dear developer
@tgtech7074
@tgtech7074 4 года назад
Md Nazmul Hossain are you able to look at the network tab in google chrome inspect to see what error the api is giving you?
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
@@tgtech7074 export const GOOGLE_API_KEY = 'AIzaSyDl5Pq00VGEmLRtY4reOKaRrDEFCkAQOaQ'
@tgtech7074
@tgtech7074 4 года назад
Md Nazmul Hossain ok that looks right. Erase that key since it’s public now and generate a new one. Make sure the key is unrestricted for testing. It’s hard for me to say what to fix without knowing what error you’re getting. Are you able to confirm whether you’re getting any data back by console logging the result of the api call (successful or error)? Or checking what the api is returning in the network tab?
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
@@tgtech7074 thanks dear developer i love you
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
please answer me
@mdnazmulhossain1100
@mdnazmulhossain1100 4 года назад
this api not working . but latitude and longitude , addrees come but map not comminng
@mackynikat8833
@mackynikat8833 3 года назад
. is steve your dad ??
@enriqueesperilla6937
@enriqueesperilla6937 4 года назад
I hate react with classes!
@tgtech7074
@tgtech7074 4 года назад
Enrique Esperilla yep, since making this video I use functional components and hooks entirely.
@RK-bh7zf
@RK-bh7zf 3 года назад
hey ${this.state.llatitude} is not taking in img url help me out
@otiliabolgar4880
@otiliabolgar4880 2 года назад
Did it work for you?
Далее
Google Places - Autocomplete in React
16:05
Просмотров 55 тыс.
Зачем он туда залез?
00:25
Просмотров 63 тыс.
Лайфхак для дачников
00:13
Просмотров 17 тыс.
Get users location with Javascript geolocation
13:54
Просмотров 56 тыс.
Get Live User Location - HTML5 Geolocation Tutorial
15:27
From React To HTMX
40:01
Просмотров 310 тыс.
React in 100 Seconds
2:08
Просмотров 1,3 млн