Reverse Geocoding with the Google Maps API

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025

ความคิดเห็น •

  • @the_danielmark
    @the_danielmark 5 ปีที่แล้ว +8

    This is brilliant! I searched for days on the internet and this is exactly what I was looking for! Thank you Steve! :)

    • @mackynikat8833
      @mackynikat8833 3 ปีที่แล้ว

      . thats what also what im going to suppose to say . tot im only the only one who is moved by sir Steve griffith teachings watching his tuturials that I need . I'm already subscribed here .

  • @nathangurdoski
    @nathangurdoski 4 ปีที่แล้ว +3

    Thank you Steve...was scratching my head for weeks (literally) ! I needed this for my full stack school project :' )

  • @frankcamberos8417
    @frankcamberos8417 4 ปีที่แล้ว +1

    Thank you kindly for this!!! I too was searching forever until I found this!

  • @DanaiKamvoussiora
    @DanaiKamvoussiora 4 ปีที่แล้ว +2

    Absolutely great video!
    By far the best explanation I've found! Thank you!

  • @behindthescenex
    @behindthescenex 5 ปีที่แล้ว +4

    You save my day sir! Thank you so much 😭🙏🏼

  • @carlospenaranda1993
    @carlospenaranda1993 4 ปีที่แล้ว +1

    genial ... muchas gracias me sirvió de mucho!!!

  • @yerson557
    @yerson557 5 ปีที่แล้ว +2

    this video is awesome, you really helped me! Thank you so much I appreciate your content.

  • @kalbossa
    @kalbossa 3 ปีที่แล้ว +1

    Thanks! Great video!

  • @hellonishant
    @hellonishant 4 ปีที่แล้ว +1

    thank you so much. it really helped me.

  • @nimatsergiu2942
    @nimatsergiu2942 4 ปีที่แล้ว +2

    Excellent! I hope you have a good day just like you made mine buddy! :P

  • @mackynikat8833
    @mackynikat8833 3 ปีที่แล้ว

    . hi sir if youre not having a good day as this moment , haha . you can already be happy now :> from the first minutes watching this vid already figured this out but still here :> im the guy from your sass content :D

    • @mackynikat8833
      @mackynikat8833 3 ปีที่แล้ว

      . almost done with my e'commerce man hope can already sell this soon , ahaha

  • @danyalsajid123
    @danyalsajid123 4 ปีที่แล้ว +1

    Awesome tutorial, thanks you Steve. I want to ask if there is a way to get the list of all the places (stores/schools etc) in a region or may be inside a circle of 1000 ft.
    I want this for a project. Need some help.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      For that I think you want the Places API - developers.google.com/places/web-service/overview

    • @siddharthsajit7357
      @siddharthsajit7357 ปีที่แล้ว

      I know I am 2 years late but did you succeed @danyalsajid123 ?

  • @joel9909
    @joel9909 4 ปีที่แล้ว +1

    Hey Steve, was thinking of a complete reboot for my js knowledge. I decided I want to do this with your tutorials for about 2 - 3 weeks, how do you recommend I start.
    I was really thinking of starting from the js in the browser series but seems there are quite some things I do not know in the js from start series.
    In short, how do you think someone who has someone who has some js knowledge, but still considers himself a beginner, goes through your tutorials?
    Thank you!!

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      The JavaScript from the Start playlist is about any JS topic that applies in any environment (NodeJS or Browser). JavaScript in the Browser is about JavaScript that applies specifically to the browser, so a lot of HTML5 based things. There is a NodeJS server-side playlist about the JS that applies to Node instead of the browser. There is an Express playlist and many others by topic area, like functions, or loops, or ES6+, AJAX, Promises, Arrays, etc. The topic area ones are much shorter.
      There is no real order that you have to use with the lists. Browse through the playlists and pick one that appeals. Learning should be fun.

  • @kopf1989
    @kopf1989 4 ปีที่แล้ว +2

    And how can you pass a set of address information (street, city) in JSON format to php now, to store them? I´m just not able to pass my json variable outside of the loop :(

  • @levihuibers5463
    @levihuibers5463 4 ปีที่แล้ว +1

    How do I get the city into a normal variable?
    if (part.types.includes("administrative_area_level_2")) {
    document.body.insertAdjacentHTML(
    "beforeend",
    `City: ${part.long_name}`

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      `parts` is already a local variable.
      let parts = data.results[0].address_components;
      However, results is an array that has many possible different results.
      address_components is also an array that could have between 1 and 8 entries. The first part tends to be a road and the second or third can be the city.
      Instead of address_components you could use formatted_address.
      The results that you get back are just one big object filled with lots of properties and objects and arrays. You need to work with the data and loops to find what you want.
      If you wanted one of the formatted addresses you could do this:
      let addr = data.results[0].formatted_address;

  • @ShreyasGeetha
    @ShreyasGeetha 2 ปีที่แล้ว

    Thank you very much

  • @yojey
    @yojey 5 ปีที่แล้ว +1

    Hi Steve,
    I wanted to know is there any way to get the city from lat long other than parsing the geocode api response and checking the address component type?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว

      Nope. That is the purpose of doing the reverse geocoding and getting the information, so you have all the possible parts of the location address.

  • @maxtayebwa8987
    @maxtayebwa8987 5 ปีที่แล้ว +1

    Superb!

  • @pierosabino
    @pierosabino 4 ปีที่แล้ว +1

    Hi, how can I show the data obtained by geocoding or reverse geocoding on a map?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      I have a playlist on mapping with the Google Maps API. It starts with this video - th-cam.com/video/EwZUQuPjakg/w-d-xo.html

    • @pierosabino
      @pierosabino 4 ปีที่แล้ว

      So I have to set up the map and through geocoding get the data to show.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      @@pierosabino yes. They are two separate parts of the API and you need both.

    • @pierosabino
      @pierosabino 4 ปีที่แล้ว

      @@SteveGriffith-Prof3ssorSt3v3 OK thank you very much

  • @fingerbob73
    @fingerbob73 5 ปีที่แล้ว +2

    Why do the looped outputs appear in the browser in reverse order?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว +2

      Good question. It looks like they are in reverse order because of the order that I wrote the if statements. But I am inside a loop that looks at the types in the numerical order of objects inside of address_components. The street name is the first item and postal code is the last. The country was index number 5, which is the second last object in the array to be passed to the function inside forEach. So, country gets added just before the tag last.

    • @mackynikat8833
      @mackynikat8833 3 ปีที่แล้ว

      . also what i had first in mind . also tought that if you wanted the right order you can just create the order . right

  • @rikizy528
    @rikizy528 5 ปีที่แล้ว +1

    Which extension are you using for html tag color open closed line tag just like bracket colorizer for js

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว +1

      I'm just using the Theme "Dark+ (default dark)"

    • @rikizy528
      @rikizy528 5 ปีที่แล้ว +1

      @@SteveGriffith-Prof3ssorSt3v3 finally i get it, It is indent rainbow extension

  • @abin6909
    @abin6909 3 ปีที่แล้ว

    Do you have a tutorial on how to take a zip code as an input and find all the other zip codes within a certain radius of the input zip code, radius being adjustable by the user?

  • @echochillASMR
    @echochillASMR 5 ปีที่แล้ว +1

    Hi thank you for this. Can we get full residential/commercial addresses on user location so they can select their address, rather than typing their home/business address?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว +1

      That is exactly what this is meant to provide.

    • @echochillASMR
      @echochillASMR 5 ปีที่แล้ว

      Steve Griffith thank you. Do you know any working example of this? Do you have a link please?
      Do you need to type anything to see the list?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว

      @@echochillASMR my code sample is linked to in the description. It shows how it works. Any website that provides an address without the user having to type anything is likely using reverse geocoding.

    • @echochillASMR
      @echochillASMR 5 ปีที่แล้ว

      Steve Griffith thanks Steve!
      I managed to implement, but sometimes the list does not include the correct door number. Is there a way to expand the area? So it will show few more door numbers around my house?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว

      @@echochillASMR there is only so accurate it will be.

  • @hirisraharjo
    @hirisraharjo 3 ปีที่แล้ว

    Great video! But what about if we wanted to do an asset tracking like uber? What tech stack do we need? Does web socket and google maps api / mapbox is enough?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว

      There are many different tech stacks that you can use to accomplish this. You need some type of database for your own data, server-side code for your own API, there are many different places and ways to host that and communicate with the clients, then on the client side you could have a web app or a native app that does the geolocation and mapping, plus communication with the server via http rest services or web sockets. Many different combinations of tech stacks and languages and apis and frameworks could be used to accomplish this.

    • @hirisraharjo
      @hirisraharjo 3 ปีที่แล้ว

      @@SteveGriffith-Prof3ssorSt3v3 Sorry what I mean is only for the navigation parts of it not the whole app. Is it enough? Or maybe polling / grpc is better?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว

      @@hirisraharjo like I said, there are lots of ways to build something like that. I can't say what architecture is best or even sufficient without knowing all the details of the project and spending some time to design it.

  • @emiruzunovic6781
    @emiruzunovic6781 3 ปีที่แล้ว

    Hi thanks for the video, Is it possible to get an address list from the specific area for example zip code or polygonal shape?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว +1

      It won't give you a list of addresses if that is what you are asking. It tries for one best address.

    • @emiruzunovic6781
      @emiruzunovic6781 3 ปีที่แล้ว +1

      Steve Griffith - Prof3ssorSt3v3 Ok, thanks for explaining that.

  • @jivanmainali1742
    @jivanmainali1742 4 ปีที่แล้ว

    With node-fetch to do post request with api key but couldn't do that but did with axios. Is there possible to do with node-fetch?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      yes. node-fetch works just like fetch in the browser.

    • @jivanmainali1742
      @jivanmainali1742 4 ปีที่แล้ว

      @@SteveGriffith-Prof3ssorSt3v3 yes but with fast2sms message service I am using headers authorization api key which is not working as expected but I am able to do same with axios. Could you plz help?

  • @alexisperez-88
    @alexisperez-88 ปีที่แล้ว

    Hi! I'm getting this error: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  ปีที่แล้ว +1

      If you have registered with Google to get your own Key and are using the correct URL you should not see that message.

    • @alexisperez-88
      @alexisperez-88 ปีที่แล้ว

      @@SteveGriffith-Prof3ssorSt3v3 Hi, I was using my own key but for some reason I got that error. I used the reverseGeocode ArcGIS REST APIs and the issue is fixed

  • @fatmaelzahraamahmmoud1849
    @fatmaelzahraamahmmoud1849 2 ปีที่แล้ว

    Excuse me sir, would it works by using angular frame work?

  • @KrishnaGupta-vj5ev
    @KrishnaGupta-vj5ev 4 ปีที่แล้ว +1

    Can I use this api without actually paying just for experimental purposes?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      You have to provide payment info to create your account. However, you get free credits to use at first for testing.

  • @mackynikat8833
    @mackynikat8833 3 ปีที่แล้ว

    . sir can you tell me whats wrong with my google.com/maps/api/gecode/json? ? my state looks like a string. and im also having invalid latling invalid request parameter

    • @mackynikat8833
      @mackynikat8833 3 ปีที่แล้ว

      . damn this sir i alreeadt dont know what to do . shouid i register to billing first before can i use the api ? im circling theads with geolocation api including client id, my coordinates is 1 digit followed by another 6, used sensor thought my backticks for lat and long for the api will be proper highlightened, swap latlng to key. help me sir. please. do i need to register to billing info first ?

    • @mackynikat8833
      @mackynikat8833 3 ปีที่แล้ว

      . i also encountered an error i.e an error occured client id i.e

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว

      You have to register and set up billing before you can use any of the Google mapping API keys.

    • @mackynikat8833
      @mackynikat8833 3 ปีที่แล้ว

      . sorry man . got paranoid keep telling you about baackticks over and over didnt realize soon why my template strings not working on the api, not highlithened . hehe

  • @artstaley641
    @artstaley641 4 ปีที่แล้ว +1

    Steve, I'm getting a cors issue when I try to launch my project. Google hasn't been very helpful with a solution.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      If you look in the browser console you will see the CORS error message that will include all the details for the cause of the problem. The CORS error messages are very detailed.

  • @etewish
    @etewish 4 ปีที่แล้ว

    Hi. Great tutorial! I have an excel sheet containing around 3500 coordinates. I need to get the City and district. Can you please point me to the right direction?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      For JavaScript to work with the data you need to convert the excel spreadsheet to XML or JSON.
      Then it is just a matter of looping through the data and making a call to the reverse geocoding API like in the video.
      If you are using NodeJS on the server to open the file, it can be exported from excel as a CSV file. Then you can use any of a number of npm packages to convert from CSV to JSON. Eg: www.npmjs.com/package/csvtojson

  • @etelot
    @etelot 3 ปีที่แล้ว

    Looks like "types" is not coming in the response.

  • @fakoredeolapade1043
    @fakoredeolapade1043 4 ปีที่แล้ว +1

    nice

  • @benslimanemohammed8121
    @benslimanemohammed8121 4 ปีที่แล้ว

    enable billing ?

  • @davidcedeno878
    @davidcedeno878 3 ปีที่แล้ว

    how much does the geocoding api cost ??????

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว

      You will have to look at the prices on the Google geocoding/maps website.

    • @davidcedeno878
      @davidcedeno878 3 ปีที่แล้ว

      @@SteveGriffith-Prof3ssorSt3v3 there are no prices on the Google geocoding / maps website

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว

      @@davidcedeno878 when you sign up for an account there is.
      th-cam.com/video/EwZUQuPjakg/w-d-xo.html

  • @eagillum
    @eagillum 4 ปีที่แล้ว +2

    Stonewall! I know Stonewall, MB! (Also, I'm mad that getting the lat and long of addresses requires coding. I can't believe what a process this is.)

  • @TioNorris
    @TioNorris 5 ปีที่แล้ว +1

    I'm getting an error that says "you must enable billing" it says that I have to pay to use the API. lol

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว +1

      You dont have to pay. You just have to provide billing information- basically a credit card

    • @TioNorris
      @TioNorris 5 ปีที่แล้ว +1

      @@SteveGriffith-Prof3ssorSt3v3 Oh, thanks! I thought I would be charged hahaha
      Btw, your tutorial is very good!

  • @bahram1010
    @bahram1010 4 ปีที่แล้ว +1

    Please help me bro, I have an error
    error_message: "Invalid request. Invalid 'latlng' parameter."
    results: []
    status: "INVALID_REQUEST"
    __proto__: Object

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      The values that you are putting in the query string after latlng= are not formatted properly.
      Are you using backtick characters around the template string?
      Check the values you are using for the querystring.

  • @deepsh1316
    @deepsh1316 4 ปีที่แล้ว

    Hi Steve, is there a way for me to reach out to you through email. Thanks.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      For what reason?

    • @deepsh1316
      @deepsh1316 4 ปีที่แล้ว

      @@SteveGriffith-Prof3ssorSt3v3 Wanted to check if you provide API reviews.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      @@deepsh1316 No. I dont have time to do reviews.

    • @deepsh1316
      @deepsh1316 4 ปีที่แล้ว

      @@SteveGriffith-Prof3ssorSt3v3 Thanks for revert. Np. Just wanted to check.

  • @mackynikat8833
    @mackynikat8833 3 ปีที่แล้ว

    . is this one free sir ?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว +1

      Google Maps requires you to provide payment information when you sign up for their accounts but they provide free credits to use before you would be billed. This works for small sites.