Citywide public transit tagging system

Source: Internet
Author: User

 

Baidu map provides a stable and high-speed map service. However, because the Baidu map development team is still in the growth stage, it has not been able to provide sufficient API interfaces for the majority of secondary developers. When developers need to implement specific functions, the APIS provided by Baidu map are often stretched.

 

I hope to implement this function: click the mouse at any location on the map to obtain all bus routes that can go directly to the map. For example, if the black spot is a mouse click, the system automatically lists the bus lines (blue lines) that can go directly to the place ).

 

 

Baidu map APILocalSearch

Transitroute and other related functions cannot directly meet the above requirements, and Baidu map API does not directly query the bus route interface. The only similar interface provided by Baidu API is: the user gives the starting and ending point coordinates (longitude and latitude, name, etc.), and the system returns the bus plan between two points.

 

In order to implement the above functions, we found that abcmap.com provides a complete bus query solution. However, I am personally worried that if abcmap.com does not have CDN, the access speed may be faulty in some regions, affecting the user experience. Although Baidu has good access speed, it does not provide corresponding API interfaces. Can we combine them? This is the idea of this article.

 

 

(1) Use the interface provided by abcmap.com to obtain the bus route for the whole city and save it to the local database. Personally, this is a bit overcast...

(2) Search for all bus stops near Baidu map by clicking the mouse. Here, we can define "nearby" as a range of less than MB around the mouse click point (adjustable parameters ).

(3) Search for bus routes on Baidu map using APIs provided by Baidu map. Perform the following operations on the target_station bus station obtained from (2:

  1. Query all the lines that contain the bus station in the database to obtain the terminal terminal_station of these lines.
  2. Use the Baidu map API to call search_bus_routing (target_station, terminal_station) to obtain the bus line between target_station and terminal_station.
  3. Draw the bus route obtained in step 2 on Baidu Map

 

The other question is, in (2), how do I find a nearby bus station? What I can think of here is the trick:

  1. In (1), you have obtained the names of all bus stations. You can query the coordinates of these sites one by one on Baidu map and store them in the database.
  2. When calculating the bus stops near any point, you only need to calculate the distance between the point and all bus stops stored in the database, and select several nearby bus stops.

 

 

This is all done.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.