Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the longitude and latitude conversion of address by Qt

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to achieve Qt address latitude and longitude conversion, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

I. Preface

The function of conversion between address and latitude and longitude is also often used, such as the function of the last route plan query. Before, the official website provided the direct input of Chinese characters of the departure place and destination to query the optimal route. After that, only the longitude and latitude coordinates of the departure place and destination are supported. This is a bit of a roundabout. What is the latitude and longitude coordinates that allow users to enter? Few users can understand it, so it is necessary to query the Chinese characters of the departure place and destination entered by the user to the corresponding longitude and latitude coordinates, and then pass the query results into the JS function of the route query. Why did you suddenly turn off the function of automatic longitude and latitude conversion of this address? I went backstage to have a look, and it turned out that this function had become a charging module.

The longitude and latitude exchange function of the address is only available on the online map, because you need to go to the server to query the corresponding data and get the returned data. Baidu Map needs to use BMap.Geocoder to achieve the exchange of these two functions. He has built-in getPoint function to convert the address into longitude and latitude coordinates, and getLocation function is responsible for converting longitude and latitude coordinates into addresses, so encapsulate these two functions into JS functions, which can be called directly every time needed.

II. Functional features

Both online map and offline map modes are supported.

Support webkit kernel, webengine kernel and IE kernel at the same time.

Multiple dimension points can be set, including name, address, longitude and latitude.

You can set whether the map can be clicked, dragged, or scrolled.

You can set the protocol version, secret key, theme style, central coordinates, central city, geocoding location, and so on.

Can set the map zoom scale and level, thumbnails, scale, road information and other controls visible.

Support map interaction, such as mouse press to get the latitude and longitude of the corresponding location.

Support to query the route, you can set the starting point, end point, route mode, route mode, route scheme (minimum time, least transfer, least walk, do not take the subway, shortest distance, avoid highway).

Can display dots, lines and surfaces tools, and can draw lines, points, rectangles, circles and so on directly on the map.

Administrative divisions can be set up, a certain urban area drawing layer can be specified, and the online map automatically outputs the administrative division boundary points to the js file for offline map use.

Multiple coverings can be added statically or dynamically. Support points, broken lines, polygons, rectangles, circles, arcs, point aggregations, etc.

The function interface is friendly and unified, and it is easy to use, just one class.

Support js dynamic interaction to add points, delete points, clear points, reset points, no need to refresh the page.

Support any Qt version, any system, any compiler.

Third, effect picture

4. The related code void MapBaiDu::addGeocoder (QStringList & list) {/ / address is parsed into coordinates + coordinates into address list

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report