[英]Geographical location in google maps
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?
我将每个广告的纬度和经度保存在我的数据库中,但我想添加一个选项,在地图上显示用户并显示其周围半径为 1 公里的所有可用广告,但我不知道如何,有人可以帮助我吗?
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.使用 SQL Server 将纬度/经度存储为
geography
数据类型。 See geography (Transact-SQL) .请参阅地理 (Transact-SQL) 。
From your webpage, retrieve the user location.从您的网页中,检索用户位置。 See Use Geolocation API with Angular.js .
请参阅将地理定位 API 与 Angular.js 结合使用。
Send back the position to your web api (create a new action into your controller).将位置发送回您的 web api(在您的控制器中创建一个新操作)。
Write a stored procedure that take the user position as parameter and return the advertisement around it with radius of 1 km.编写一个存储过程,以用户位置为参数,并返回其周围半径为 1 公里的广告。 See SQL Geometry find all points in a radius (Geography and Geometry have quiet the same functionalities).
请参阅SQL Geometry 查找半径内的所有点(Geography 和 Geometry 具有相同的功能)。
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 !祝你好运 !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.