Using my android app, I am taking the current location of the user in a regular interval and displaying it on a Google map as marker using,
$map->addMarker($row['lat'],$row['lng'],$isclickable,$title,$info);
Please help me draw a route joining these markers.
One more thing, I am using Location managers Network provider for fetching the coordinates, so most of the points(latitude, longitude) are off the road. Is there any way to get it properly on the road?
Related
I want to fetch locations (just the address. No coordinates) from my database (mysql) and pin them on google map using markers
I come from China, so I use Baidu map. Talk about my development process: the request of Baidu Maps API incoming address, API will return to the coordinates, the coordinates of the third party jquery. Similar picture effect enter image description here
I'm working on a project (web application) kind of a trip planner which uses maps to show directions (driving) for the users which they enter destinations of their trip.
and I'm using Mapbox web services to do this.
What I'm trying to do is get the directions for user input which was entered early stage and plot it on a mapbox map.
I know how to get the directions calling the api directly, but I'm having hard time for show this data on a map, I know there is this directions.js which is a pulgin for mapbox but I dont understand how to implement it.
and is there a better or easy way to achieve this. thanks in advance
Mapbox Directions api
Leaflet plugin for the Mapbox Directions API
Check out this code example which does example what you want:
https://www.mapbox.com/mapbox.js/example/v1.0.0/mapbox-directions/
I have 100K+ lat/longs in a SQL database, and I want to plot them on a google map. The user will input an address to find points close to that address. How should I do this? I have the map working, with the ability for the user to enter an address and have the map center on this point. Just need to add the pins.
I'll be building the front end in JS, and any backend needs in PHP.
Lets start with the search for address, I would use the Google places API. This will allow you to localise your results and get the coordinates of the place in question.
Once you have the coordinates I would head off to the server to do a lookup, if you are using MySQL you can use their spatial extensions which have some handy ways of indexing things spatially.
You say you have 100k items, obv there is NO way that you can send all of them to the frontend to display on the map, you will need to limit your result set or else the users browers will cry tears of blood as it tries to render and handle all of them. You can have a look at the Google Maps Marker Clusterer for a nice way of displaying a high density of markers.
I have been looking through the documentation for the API and not sure if it is possible to list multiple select stores near the submitted address.
Ultimately something like the following website: http://www.evolutionofsmooth.com/locator/
It seems like they have each location stored in a db but I can't see it that likely since it would be pretty huge to do something like that.
Any ideas?
They probably did store all the shops in a database. They saved the latitude and longitude of each shop. Then they load, via AJAX, all the shops into the google map. Google maps has a tutorial for creating a storelocator.
Google maps api v3 has a function called ClientLocation this can, on base of the IP-address, return the current position of the user viewing the google map. This way the closest shops can be highlighted or put on top of the list.
Hopes this will help!
I am the owner of a business that is building a new website application. My partner is the programmer who is doing the development and neither one of us has any real in-depth experience with Google Map API or it's polyline/polygon area capabilities.
We need an easy way to capture inputs within our user admin area where our locations can enter their service coverage area info i.e. 1st street north of Jones blvd, or a 5 mile radius from the location address, etc. and have the Google Map API plot the polyline borders.
Then, visitors to our site need to be able to see this info when they view the google map for one of our locations and also see if their service address falls within that service area or not. We then need to set a flag somehow to trigger a notification to the visitor that their address is not eligible for service or delivery.
If anyone can assist us with this (example php code to interface with the suggested APIs would be preferred and ideal as we simply don't understand the complexities of the Google API, the polyline coordinate capture tool, etc), it would be greatly appreciated, as we have struggled to figure out how to create this in php and more importantly how to integrate it into our existing site.
Update: Thank you for your answer CodeMeIT...how do recommend we capture these longlats in our sql database...i.e. what is the field format or type and do we need to have separate fields for long and lat, and how can we standardize for all locations, i.e. how many long and lats are needed to create a polygon area, as we want to be able to have our location managers input this info for their own locations from their user login areas.
Draw polygon on map
You can draw polygons that covering your service area on google map. Those polygons are defined by a set of latlongs that you can collect from a google earth and sasve them somewhere. Once you had all the coordinates that can cover your each service area, you can see the link to find out how to draw them on google map
Google Map polygons Sample
Check if user is within service area
If the user had address information entered or stored somewhere, you can take the address to google map geocoding service to find out the address's latitude and longitude.
Google MAP Geocoding Service API
After getting the address' coordinate, the code can check if the coordinateis within any bound of the polygons of your service area. If false, that is out of service area.
PHP for checking point in polygon