我正在为一家快递公司写申请。我有一个地址实体,我想对地址进行地理编码并将经纬度保存在 sql 服务器中以进行路由。我是一个新手,我不明白如何使用来完成这个。我想在我的 vb lightswitch 应用程序中使用openstreetmaps,我需要有人一步一步地向我解释我需要做些什么来完成这个。我今天整天都在研究地理编码,但我找不到开始所需的资源。那里有很多信息,我发现没有什么是逐步做到这一点的。我不知道如何使用 REST 或 SOAP 生成包含数据的 xml 文件。当我说一步一步时,我的意思是字面意思。我是一个菜鸟,请帮助我。
1 回答
Oh Boy, this is a very complex question. First of all, what are your needs?
- Geocode your address to Long/Lat
- Storing Long/Lat per address
- Getting routes between two addresses (?)
- Store Routes between two addresses (?)
Geocode your address to Long/Lat
When working with OpenStreetmap data (what I haven't done for quite a while) I prefer the Mapquest Geocode API. But if you want to set up you own Server, or don't want to use Mapquest you should implement Nominatim (MQ, OSM). If you can handle HTTP APIs and JSON you should be fine with the service pretty fast.
Storing Long/Lat per address
This is tricky. As far as i know it's not possible to store geospacial information with LS. I would try to have two string fields in LS with the serialisation of Long/lat. I would also suggest to use SQL 2012, because it has a richer geospacial function set. Next I would try to set a trigger in the SQL server to store a serialised geo-point as SQL geography point. Depending on what you are doing you might want to set a trigger for serialising a SQL geography point, when it's changed. This way you are able to easily access all the cool SQL Server geography stuff.
Getting/Storing routes between two addresses
I'm not sure if you need more information on that topic, so i'll not dig in very deep. With mapquest you can use the Directions Service. I don't know a good Directions service for OSM, but this information may be outdated. If you stay to the service results it shoudn't be a problem to store routes, given the information about Storing Long/Lat per address.
I hope this helps!