Get Google Streetview heading by PHP - php

Good day, I am trying to setup a Streetview Static API in PHP.
I got as far that I got the address to coords by GeoCode.
I got the image of the address to show.
The last part however is still puzzling me. Thats the heading.
https://maps.googleapis.com/maps/api/streetview?size=800x800&location=%2052.525113,%205.487970&fov=90&heading=0&pitch=0&key=*GOOGLE_API_KEY*
I can find a lot of explanations about obtaining the heading by Javascript. But none in the form of a PHP solution.
It almost feels like it is impossible.
But if there'd only be a way to calculate the exact heading : &heading=0 of the building it would be solved. But are there any specific google API calls required?
Thanks in advance!

Related

How to Get 2 Digit Country Code by Using php

Hello Friends I was Developing an website which i only want to be viewed by Indian (People of india) , and I Want to Get The Two Digit Country Code for that using php. I browsed to http://php.net and tried using geoip_country_code_by_name , geoip_country_code3_by_name and geoip_country_name_by_name but None of Function worked , I have tried on my Existing XAMPP Installation and W3schools PHP runner but it says function not exists and i also have checked to PHP version. What Should i Do. I also Have tried methods form here and after Google(ing) whole day i finally came to ask here .Feel Free to Suggest Edit or Close this Question
Based on some research, the best way seems to be by IP. This link will help you if you go this way.
https://stackoverflow.com/a/13600004/13604954
But some VPN can easily change is on IP.
ref. https://nordvpn.com/blog/vpn-ip-location-changer/
So good luck! 😉
The easiest way will be to asking the user is country and if not what you want, just show another page.

google API (Geocoding) request returns wrong language

related to the doc https://developers.google.com/maps/documentation/geocoding/intro i am using this api request to figure out the full address data (especially lat/lon)
https://maps.googleapis.com/maps/api/geocode/xml?address=30449+hannover&sensor=false&language=en&key=YOURAPIKEY
the language parameter is the important part. its EN for english.
lets now face the result: "Niedersachsen" this part is german.
okay.. what a pitty.. i thought that google possibly doesnt know the english name of it so it returns the default german name since my request is about a german town but then i changed the api request a little bit and removed the ZIP (30449) of the address.
https://maps.googleapis.com/maps/api/geocode/xml?address=hannover&sensor=false&language=en&key=YOURAPIKEY
now my result was CORRECT: "Lower Saxony" in english.
so obviously google knows the name.
am I doing something wrong? do you have any ideas? i cant get this issue sorted...
please advise.
thanks!
p.s. its a little related to this I think: Google Geocoding API returns wrong language in response but not completely... I have also already opened a bug report on google side just in case...
I'm having Geocoding issues as well, ever since the new "pay-as-you-go" API nonsense. Installed new API key after activiating a new CC attached accnt with Google dev. Fixed things for a moment, but seems like cache issues are keeping the geocoding, as well as front side UX with the map embed itself (markers don't show, limited/no functionality). Wish I had an answer for you, but for now, just commiserating...

google maps, google places and save marker to a database

First of all I would like to tell you that I am not sure if I use the terms correctly so please excuse me for any misunderstandings. I will try to clear everything.
What I want to do is to let the users on my website to select their favorite bar or restaurant and add it to their profile.
It should be more or less like maps.google.com but in a smaller dimensions let's say 400x400. The users will be able to search for a place and once they find it they will be able to save it to their profile.
I am confused though because Google offers the Google Maps and the Google Places. I do not see any tutorials around regarding Google Places..
The question is.. Can I do my small project by using google maps or I really need to use google places?
Is there any tutorial/link which shows how to store on my database the current map location?
Thanks in advance!
Ok after some more searching I found my answer which was pretty simple.
It looks like I can get the lat and lng from place.geometry.location .
The rest about storing it to the database is easy!
Thanks anyone who at least read my post!
Cheers!

How do I calculate the driving distance between 2 places along with a map in php

I am looking for driving distance between two address/postcodes with displaying both on Google Map in php
I have search a lot of Scripts but most of them calculation distance only. I also want the both address along Google map also.
like this http://www.1stwebdesigner.com/wp-content/uploads/2010/06/distance-finder/source-distance-finder-google-maps.php
But this link calculate the "straight line distance" between two address and also show them on map
Please help me, i don't want straight line. I want driving calculation alone with map.(The script also show address on Google map)
You can do this with the API, I suggest you 'google' the google API for specifics, the documentation for google maps v3+ is awesome, you should have no problem if you're not reaching way outside your knowledge base.
and +1 #HeitorChang for that comment, I didn't see it.

Getting information from Gmaps like grassland, street, water etc

I'm thinking about a project, where I need such informations as described in the title. Does the Google Maps API provide something like this, or does anyone know how to get these informations?
Project will be done in PHP, HTML and Javascript.
AFAIK Google doesn't provide this information via the API. The only thing I can think of is getting the image, and then detecting the colour. A map of colour hex values against point type might give you what you need.
However, this may well break the Terms and Conditions, depending on what you're doing.

Categories