Baidu map API connects to local database

Source: Internet
Author: User

A module recently used in the company's project. Connect to a local database through the Baidu map API. The marked points in the displayed Baidu map are all records saved in the local database.

As I just graduated, I work as an ASP engineer in my company. NET is only half a year old, so the language expression and organization are not as smooth as the predecessors, and it is the younger brother's first blog. Please give me more advice.

First, create a database table. Because it is only a small test case, only three fields are used. The Point field stores the latitude and longitude, and the Title field stores the name of the mark Point.

Next, add a page. On the add page, you can obtain the longitude and latitude of the map based on the entered name and address. Then, you can access the database to save the information and latitude and longitude of the mark point in the data table.

<Html> $ (). Value = LocalSearch = cc = $ (). val () + $ (item = (I =; I <item. getNumPois (); I ++ LocalResultPoi = document. getElementById (). value = document. getElementById (). value + LocalResultPoi. point. lng ++ LocalResultPoi. point. lat + </script>

The back-end database access code uses a simple three-tier architecture.

    Button2_Click(= = = = = 

After performing the preceding steps and running, you can enter the tag points you want to save in the text box of the page name and address. Then, click the latitude and longitude query button to display the latitude and longitude of the marked point in the text box below. Click the Add button to add the data. The key to querying Baidu map API is longitude and latitude. Therefore, obtaining the longitude and latitude and adding them to the database are the key to finding out the corresponding points.

Then we need to associate the query page with the database just now, and mark the mark point on the Baidu map on the page.

<% @ Page Language = AutoEventWireup = CodeBehind = Inherits = %> <! DOCTYPE html PUBLIC> 
   = = = = MP.GetList( ).Tables[ point =  marker =  map =  opts =  infoWindow =  addEventListener =  ( i = ; i < da.Rows.Count; i+++=  + da.Rows[i][] + +=  + i +  + i + +=  + i + +=  + i +  + da.Rows[i][] + +=  + i +  + da.Rows[i][] +  + i + +=  + i +  + i +  Point =);              sb.Append();              sb.Append();               sb.Append( + Point + );             sb.Append();              sb.Append();             sb.Append();                    sb.Append(

Concatenates strings in a loop. Obtain the longitude and latitude of the database to use the Baidu map API.

If you are not good at expressing all this in words, let the Code represent my heart.

Related Article

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.