I'm working on project that deals with advertisements and google maps. I save every advertisement latitude and longitude in my database, but I want to add an option that show user on the map and show all available advertisement around it with radius of 1 km, but I don't know how, Can anyone help me?
Asked
Active
Viewed 1,517 times
1 Answers
0
Seems to be an interesting project. These are the steps I suggest you :
Store you latitude/longitude as a
geography
data type using SQL Server. See geography (Transact-SQL).From your webpage, retrieve the user location. See Use Geolocation API with Angular.js.
Send back the position to your web api (create a new action into your controller).
Write a stored procedure that take the user position as parameter and return the advertisement around it with radius of 1 km. See SQL Geometry find all points in a radius (Geography and Geometry have quiet the same functionalities).
Send the Advertisement location to the client side and use Google Map to show it (I am sure you're going to find some good tuto about that).
Good luck !