Google maps distance matrix api header - google-distancematrix-api

How to deal with the fact that the Google Maps Distance Matrix API does not send the "access-control-allow-origin" header like Google Maps Geocoding API does it.
I have problem using XMLHttpRequest().

I resolve this situation by adding the "Allow-Control-Allow-Origin:* " extension to chrome. After you add it, you will see an icon in green with the letters "cors" in the upper right corner. Now it's working pretty well.

Related

Google Places API - how to get the address coordinates instead of the place's

I'm using Google Places API to get a geolocation of the place. I get the points and are able to place it correctly. Searching for the place below the marker is placed in the middle of the building.
https://www.google.com/maps/place/C.D.E.-Centro+de+Diagnostico+de+Elvas,+Lda/#38.8799378,-7.1615604,20.05z/data=!4m5!3m4!1s0xd171c6f3bfd342f:0xe99e4c47a055bae3!8m2!3d38.8799892!4d-7.161476
Now what I'm looking for is to place the marker on the address of the building (basically the door) which would be here:
https://www.google.com/maps/place/R.+de+S%C3%A3o+Louren%C3%A7o+17,+7350-026+Elvas/#38.8800482,-7.1619366,19z/data=!3m1!4b1!4m5!3m4!1s0xd171c691f19dac7:0xe21f4232dc70c067!8m2!3d38.8800482!4d-7.1613894
The only way of doing this right now is to get the place, get the place detail and then, using the address making another call for the new coordinate.
Is this the only way to get the geolocation of a place's address?
Reverse geocoding is your best friend!
Input your address like so, taking out the spaces.
https://maps.googleapis.com/maps/api/geocode/json?address=R.deSãoLourenço17,7350-026,Elvas&key=API_KEY
Then access the coordinates via the geometry field. Hope this helps.

batch images along path google maps street view

Does anyone know how to interact with google maps street view to retrieve a batch number of images (~200) along the street view from point A to point B? I could always manually go and move along the street and "print screen." but this is time consuming. I work for city government, and we're trying to get more info on our streets.
You can take use of the Google Street View Image API, which gives you the ability to link to a picture of the Streetview directly. For example,
this link:
https://maps.googleapis.com/maps/api/streetview?size=640x640&location=40.720032,-73.988354&fov=90&heading=235&pitch=10
links to this image:
But there are 2 problems about this Google Street View Image API:
1) It only support up to 640x640, no bigger image for the free account.
2) I think the ToS requires the data be publicly accessible if you are using it for free.
You can solve these by applying to the Google Maps for Work, which I might able to refer you and get discounts.

How can I draw images, lines, etc. on google maps

I'm investigating how I might best create an app that allows drawing of arbitrary shapes, images, etc. on google maps, based on lat/lon coords of the shapes or coords/rotations for images. Surprisingly I haven't found anything out there that offers much in the way of flexibility. Scribble-maps has created something close to what I'd aim for, but they're using flash. I'd ideally like to build something that draws on the google maps html map.
I suppose I could build a div, lay it on top of the map, and if I can listen on the map scroll/zoom events I should be able to figure out how to do everything myself. Thoughts?
You need to use overlays, check the Google API documentation.
There's an example of mouse interaction to draw lines in the Polyline Arrays section. To show images have a look at the Ground Overlays section.
I know this is a very a late response, but we have launched an API for Scribble Maps. You can check it out at http://www.scribblemaps.com/api/

Windows Phone 7.1 - Share GPS location via SmsComposeTask

I have written a simple navigation appliaction for wp7. Now I want to integrate position sharing via SMS. For this purpose I would simply send the double longitude and double latitude values via SMS. With both values the receiver has to paste these manually to bing maps or another webservice to get my position. Is there a better way to wrap this values in a so called "position-object" which can be interpreted by the receiver and shows him the position on a map if he clicks on the message? Or is there another way o solve this?
If you transform your sms body as an URL to either Google Maps or Bing Maps with the coördinate, it could work.
But you still be better to send it as a tweet or email I guess ( the composed URL that is ).
Create a URI like this one:
http://maps.google.com/?q=[lat],[long]
For example:
http://maps.google.com/?q=-37.866963,144.980615
You can fill in the GPS coordinate to a SMS but there is now way to react to it as a recepient.

How to know Which Regions are Near Some Location in Google Map

Say I am in a location.
Near that location there are regions and famous buildings
like region, kepaduri, wisconsin street, etc.
Is there a way to query google and get info what are the close things near me?
Basically I am making an IPhone apps and I want to populate the autocomplete
If you're looking for a webservice where you send coordinates and it returns a list of "regions" that are nearby I don't beleive Google provides that, and if they did, it's got nothing to do with MKMapView.

Resources