I'm using this simple maps plugin on a site that I'm currently building http://simplemap-plugin.com/demo/ It's based on google maps API. I only have Zip (in the UK postcode) input visible so this has to be used as a base for the search. The search functionality works fine if you use a full postcode for example W1U *PZ but if you simply type W1 you end up getting a result for a road in Algeria. Does anyone know if there is away in the gMaps API to only search postcodes and exclude any Roads, so that typing the start of a postcode (the area code) will give the desired result.
Perhaps the simplest way would be to simply limit the results to a specific country, in this case I'm presuming the UK.
https://developers.google.com/maps/documentation/geocoding/#RegionCodes
The problem you're going to have with such a query however is how to decide which result to return, simply querying 'W1' is going to return an series of arbitrary addresses whose postcodes contain 'W1' for example NW1. You may be best specifying a minimum length?
Related
I can use html5 API in conjunction with Javascript to get the longitude and latitude of user. I want to take this one more further step, I want to make a search query -something like Tinder the mobile app-- to run and search for other users within a certain radius, say like run a search from my registered location to search within an 800 meters around my position for other registered locations of other users.
Any idea how to make that ? I'm a novice in php, ajax and javascript, please try to explain in simple terms.
You are looking for the haversine formulae
Check this webpage for a Javascript application of it
I'm working on a Google Maps project where we want the customer to type in an Autocomplete address and then be taken to that place on the map.
My manager wants a consistent "viewport" result when compared to the viewport achieved when searching for the same place on maps.google.com.
I found an inconsistent result for a certain location, in particular for the Australian city of Sydney.
The result I get back from Places Autocomplete for Sydney looks quite zoomed in (I used the response's viewport data and call map.fitBounds(...). I'm a first time Stackoverflow user, so I can't post images yet - instead, the effect can be seen by entering 'Sydney, New South Wales, Australia' at the following page: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
Alternatively, if I use the Geocoding API instead and take the viewport data response and use that to call map.fitBounds(...), I get a zoomed out view, similar to what I would see when I look for Sydney on maps.googles.com.
I would be very grateful for any suggestions that would provide a solution that gives my customers a viewing result that is 100% consistent with maps.google.com. For example, should I be using a different version of the Autocomplete API, or pass a special parameter? Ideally I would prefer to not be calling the Geocoding to retrieve and override the Autocomplete viewport response, since that would double up my API traffic and double the hit on Google's servers.
I look forward to any advice anybody can offer, thank you!!!
Are you wanting the map zoom level to be consistent after the search ?
I do android with google map. And just by looking at the code from the provided link above.
change that map.setZoom() method to the level you want might help.
I haven't done javascript google map api yet. Just taking a wide guess.
If I am answering the wrong question, please correct me.
I am using JavaScript code to show the multiple pin points on Google Maps using Brownfield. I set the first clicked point as the center point, and when the user clicks on any other point (which is not the center point) I want to display a route mapped from the center point to that clicked point.
I would appreciate help of any sort, including ideas besides using JavaScript.
Google has a number of services available to people who program using their Maps. Go to https://developers.google.com/maps/documentation/javascript/reference and check out the directions services. I'm not very familiar with them, but I'm guessing it's similar to their other services. You make a directions request object supplied with point a and point b, and it will send a message to Google asking for the appropriate directions, which will be returned in some sort of result object that you can use to show the way. Update point b each time the user clicks and resend the google request, and it should update the path. Check out the API and it shouldn't be too hard to get it working. As for alternatives to javascript, Google Maps is written all in javascript, so there really is no other way. But I know from experience, most of their supplied code works really well, so I bet you can get it working!
Following link will show the route between two points:
J2ME/Android/BlackBerry - driving directions, route between two locations
I am trying to get some locations in New York using FourSquare API using the following API call:
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&limit=50
What I don't understand is that if the call imposes a limit of 50 search results (which is the maximum), how can I get more locations? When using Facebook API, the results being returned were random so I could issue multiple calls to get more results but FourSquare seems to be returning the same result set. Is there a good way to get more locations?
EDIT:
Ok. So there was a comment saying that I could be breaking a contractual agreement and I am not sure why this would be the case. I would gladly accept a reasoning for this. My doubt is this: Let us say that hypothetically, the location I am searching for is not in the 50 results returned? In that case, shouldn't there be a pagination mechanism somewhere?
The API docs here can help.
Foursquare searching is very closely linked to the location 'point' (the 'll' param on the query) that you provide. The simple answer is that to find more venues within a given area, you need to simply query again with a different location 'point' within that area.
Two queries, both at points close to one another:
https://api.foursquare.com/v2/venues/search?ll=40.700,-74.000&limit=50
https://api.foursquare.com/v2/venues/search?ll=40.705,-74.005&limit=50
will get you two different sets of venues (that may overlap, depending on how close the points are).
The default intent for the search method is 'checkin', which will return the 50 most popular locations closest to that point. If instead you want to look at all the venues within an area, you can use the 'browse' intent. This takes either a 'radius' parameter, in which case it returns venues inside a circle around the given point with the given radius, or it takes two coordinates representing the 'sw' and 'ne' corners of a rectangle. So, you could do:
https://api.foursquare.com/v2/venues/search?ll=40.705,-74.005&limit=50&intent=browse&radius=50
which will give you 50 venues within the 50m circle around that point. A smaller radius will reduce the number of venues returned. So, by varying the radius and the point at which you search (or the size and position of the rectangle described by the 'sw' and 'ne' parameters), you can get more venues returned.
Hope that helps.
The current API limits results to 50. You should try altering your coordinates to be more precise to avoid not finding your venue.
Pagination would be nice but 50 is a lot of venues for a search.
Ive noticed that sometimes gmaps directions display a turn like this:
Turn right at Gallardo
and sometimes like this:
Take the 1st left onto Arregui
I need to always see the 1st,2nd,.. like in the second example. Is there a way to receive directions in this format always?. Thanks.
I seriously doubt it. There's no mention of being able to control anything except the language.
http://code.google.com/apis/maps/documentation/mapplets/reference.html#GDirectionsOptions
I do not believe so. It will give you 2nd left onto .... up to 3rd I believe after that it will just be the street name as per most directions you are given by maps / GPS systems and equipment. (The unwritten rules of the English road directions i guess)