WeChat, question. The WeChat public platform interface obtains the geographical location xml sent by the user.

Source: Internet
Author: User
. The public platform interface obtains the geographical location xml that the user sends. the function is to send a current location to the public platform, I want to obtain the longitude and latitude (x, y) of this position from the satellite API and then use this latitude and longitude to access Baidu Map interface to query the hotels near this position.

To put it bluntly, it is the function of the food god. I encountered a problem.

First, paste the xml of the location that the user sends to the public platform
  
  toUser
   
  fromUser
   
  
   
1351776360
   
  location
   
  
   
23.134521
   
  
   
113.358803
   
  
   
20
   
  位置信息 
  


ToUserName: message recipient number, generally the public platform account number.
FromUserName message sender ID
CreateTime message creation time
MsgType message type, location
Location_X geographic location and latitude
Location_Y geographic location longitude
Scale the map size
Label location information


How can I obtain the longitude and latitude in the API? In Baidu Map, how does one query nearby hotels through this latitude and longitude? I hope there are great answers and a better demo. Thank you very much.


Reply to discussion (solution)

Recently, I am working on a project with similar functions as you, using the same interface, based on the information sent by the user to the public platform, search for the buildings in the current location (the coordinates of these buildings have been stored in my local database beforehand ). I located it through the sent Location_X and Location_Y. This is the coordinate point of Google Map. although it is a little offset, it is about the same position. Currently, the problem I encountered is how to search for the real estate information in the surrounding area (such as 500 M) based on the central point. although we can calculate the distance between each building and the center point, however, the efficiency is too low. I extracted the Label location information in the XML provided, but why is it empty?

Each one is so cool.

How can I obtain the longitude and latitude in the API?

Do I have this in the API documentation? Is the XML returned above the result? So what if I read the XML data thiode?

It is not difficult to read xml data and obtain latitude and longitude coordinates. The problem is why the lable field in the xml is empty.

It is not difficult to read xml data and obtain latitude and longitude coordinates. The problem is why the lable field in the xml is empty.

I have researched this function and completed it in the afternoon. The lable in this xml is indeed empty, but I use the longitude and latitude to obtain the specified keyword of the current position. Baidu Map API.

Isn't Baidu map APIs only available with js scripts? So how do you call Baidu Map API to execute js when post is over?

Isn't Baidu map APIs only available with js scripts? So how do you call Baidu Map API to execute js when post is over?

You do not need to execute js. the interface I call directly adds parameters to the url, then obtains the returned value, and loops out the required data!


Reference the reply from jikl1982 on the 8th floor: Isn't Baidu map APIs only available with js scripts? So how do you call Baidu Map API to execute js when post is over?

You do not need to execute js. the interface I call directly adds parameters to the url, then obtains the returned value, and loops out the required data!

What parameters are added to the url of the called interface? How can I get the desired data through the passed xy in Baidu api? I am not very familiar with what kind of data you are talking about in a loop. I 'd like to paste it in a demo. thank you.

All are Daniel,

Go to comments network to find related APIs

Go to comments network to find related APIs

Public comments? After reading its interfaces, all services will be canceled on April 9!

I am also working on the latitude and longitude, and I cannot obtain the geographical location through the latitude and longitude. soso api only provides the js version of api
How did you implement it?

Recently, I am working on a project with similar functions as you, using the same interface, based on the information sent by the user to the public platform, search for the buildings in the current location (the coordinates of these buildings have been stored in my local database beforehand ). I located it through the sent Location_X and Location_Y. This is the coordinate point of Google Map. although it is a little offset, it is about the same position. Currently, my problem is how to search for the real estate information in the surrounding area (such as 500 M) based on the central point ...... What's your name? go and check it out.

Pay attention to this issue

You can first obtain the city based on the longitude and latitude, and then select the data of the city from the database, which should improve the efficiency.

There should be something like an algorithm to implement.

I cannot obtain the lable information. is the problem solved now. ,

When the obtained coordinates are obtained and the API that accesses Baidu map has a parameter that is set to 1, pois will display nearby

Similarly, how can I use js to retrieve geographical locations through APIs,

I also encountered this problem. lable is null and Baidu API is called. there is no geographical location information, only the longitude and latitude are not good. is there any great help to solve the problem, if the keyword is specified, it will be boring.

Lable is null

How did you solve this problem?

It's all ox!

I have already found out nearby merchants, but I cannot display pictures of nearby merchants! Please let me know, thank you!

Javascript API for extracting Google coordinates and converting Baidu coordinates for PHP and other server languages

http://blog.csdn.net/longxuu/article/details/10063003

I have already found out nearby merchants, but I cannot display pictures of nearby merchants! Please let me know, thank you!
Check the new version of Baidu Map API. this attribute should be available. It is worth noting that there are only a few sellers with images, and most of them do not have details yet.

Sorry !!!

Great God, I have a service number and want to implement a function similar to yours, that is, to send latitude and longitude and then call my own database, but it is weak in this regard. can you teach me, I really want to learn it!

Your own code snippets are for reference:
If (! Empty ($ postStr )){

$ PostObj = simplexml_load_string ($ postStr, 'simplexmlelement', LIBXML_NOCDATA );
$ FromUsername = $ postObj-> FromUserName;
$ ToUsername = $ postObj-> ToUserName;
$ Type = $ postObj-> MsgType;
$ Customrevent = $ postObj-> Event;
$ Latitude = $ postObj-> Location_X;
$ Longpolling = $ postObj-> Location_Y;
$ Keyword = trim ($ postObj-> Content );
$ Time = time ();
$ TextTpl ="
%s
%s
% S
%s
%s
0
";
--------------------------------------------------------------------------
Case "location ":

$ ContentStr = "your latitude is {$ latitude} and your longitude is {$ longpolling}. I have locked it! Preparing to launch Patriot attacks! ";

Break;

If you have any questions, Q: 30339245

Great God, I want to add a [location] in the custom menu. when a user clicks this menu, he will take the initiative to get his location information.

It is not difficult to read xml data and obtain latitude and longitude coordinates. The problem is why the lable field in the xml is empty.

The label is empty. it may be because when you pop up the map when you want to send the location, you click send after waiting for someone to read your address, the reading location will be slow. it is best to wait for 1 or 2 minutes to show your specific address and then send it again.

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.