Store longitude and latitude from google places API - laravel

I have a form in laravel where there is google's autocomplete field named as address. There is no map and stores address as New Road, Kathmandu, Nepal.
I need to obtain its geo coordinates(lat lng) in controller before storing to database. So that I could calculate radius from it and provide information to users about near people.

You can do it when you fill address fields on the form. Following is the code to fill longitude and latitude. And then post the form and calculate radius in your controller.
$('#latitude').val(place.geometry.location.lat());
$('#longitude').val(place.geometry.location.lng());

Related

Google places API doesn't return postal codes for large cities or centres. How do I get around that?

I'm utilising google autocomplete to allow visitors to enter towns, suburbs or postcodes, so that they can select the right one from the autocomplete list. I then need to store the postcode for that location so that I can compare that postcode to entries in a database to find service providers in that postcode.
The problem I'm now having is that the Google API doesn't return postcodes for all locations. This especially seems to be the case for larger cities. For example, it doesn't return postcodes for Melbourne Australia, Sydney Australia or Perth Australia.
Has anyone developed a solution or workaround to this issue? Any suggestions?
I've been googling for ages now and can't find a solution. Google itself doesn't seem to mention this situation in their Google Places docs.
Since many cities span multiple postal codes, you probably need your users to provide the exact street address where they need service. Fearing the tedium of entering a full street address? Fear not; Place Autocomplete can save them many keystrokes especially if you constrain results to a specific country or location bounds.
You might want to create an address form and use Places Autocomplete to auto-fill the components including postal code once the user selects the address from autocomplete predictions. This section of the documentation demonstrates how it works and this page provides sample Javascript code for implementing an auto-completing address form.

User's reviews or ratings to OpenStreetMap objects?

I have downloaded an OpenStreetMap data. This data contain useful information like spatial coordinates and the textual description of many objects. For example, the hotel Park Hyatt at coordinates (25.2435938, 55.3328381) is a spatial object stored in OpenStreetMap dataset.
I have to associate the spatial object (i.e. Park Hyatt) to a user review. It can be a user evaluation (i.e. "good" or "bad") or a user rating (like 5/10).
So, I am looking for a public dataset with user reviews/ratings of places stored in OpenStreetMap.
Until now, I have found the Google Places API. I can solve my problem using it, but it has access limits. I will need some time to obtain all ratings I need. So, I am wondering if already exists any dataset with user ratings to OpenStreetMap Objects.

RethinkDB query OrderBy distances between central point and subtable of locations

I'm fairly new to RethinkDB and am trying to solve a thorny problem.
I have a database that currently consists of two kinds of account, customers and technicians. I want to write a query that will produce a table of technicians, ordered by their distance to a given customer. The technician and customer accounts each have coordinate location attributes, and the technicians have a service area attribute in the form of a roughly circular polygon of coordinates.
For example, a query that returns a table of technicians whose service area overlaps the location of a given customer looks like this:
r.db('database').table('Account')
.filter(r.row('location')('coverage').intersects(r.db('database')
.table('Account').get("6aab8bbc-a49f-4a9d-80cc-88c95d0bae8d")
.getField('location').getField('point')))
From here I want to order the resulting subtable of technicians by their distance to the customer they're overlapping.
It's hard to work on this without a sample dataset so I can play around. I'm using my imagination.
Your Account table stores both of customer and technician
Technician document has field location.coverage
By using intersect, you can returns a list of technician who the coverage locations includes customer location.
To order it, we can pass a function into orderBy command. With each of technican, we get their point field using distance command, return that distance number, and using that to order.
r.db('database').table('Account')
.filter(
r.row('location')('coverage')
.intersects(
r.db('database').table('Account').get("6aab8bbc-a49f-4a9d-80cc-88c95d0bae8d")('location')('point')
)
)
.orderBy(function(technician) {
return technician('location')('point')
.distance(r.db('database').table('Account').get("6aab8bbc-a49f-4a9d-80cc-88c95d0bae8d")('location')('point'))
})
I hope it helps. If not, let's post some sample data here and we can try figure it out together.

Bing Map not bringing city in India

Does Bing Maps Api show all cities inside India ?
I am currently using the Bing Maps APi inside my application to find coordinates and City based on Postal Code entered by the user. This is how i am using the api.
http://dev.virtualearth.net/REST/v1/Locations?CountryRegion=INDIA&postalCode=683101&key=BingMapKey
This returns the latitude and longitude, but locality (City) is blank.
How can i get the city too ?
I was planning to use google geocoder before, but google prohibits using their api without showing the map.
Thanks !
The issue here is that Bing Maps currently does not support postal codes in India. As such the returned result is for the country of India.

Create an event with latitude and longitude

How can I create a Facebook event in Graph API setting latitude and longitude?
I have tried the Graph API Explorer, using a post method to https://graph.facebook.com/MY_ID/events and parameters.
All works fine, except for latitude and longitude. I also have tried to create a local page with a valid location and set the page_id/location in event's parameters, but that only creates the event assigned to the page.
What is the solution?
The latitude and longitude are part of the Venue data on an event, but when you create the event, they need to be top level parameters.. Once the event is created and you query for it using the /{eventid} query, they will show up in the Venue JSON node.
I have been experiencing the same problem and have found no method of posting event data that results in saving latitude and longitude. What I have discovered is that after an Event is created editing the event - even with no changes - results in a calculation of the latitude and longitude. The resulting calculated values are slightly different than those passed in the post so these values are clearly not related the parameters I passed.

Resources