-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add TianDiTu(map provider in china) supports #13430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /**************************************************************************** | ||
| * | ||
| * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
| * | ||
| * QGroundControl is licensed according to the terms in the file | ||
| * COPYING.md in the root of the source code directory. | ||
| * | ||
| ****************************************************************************/ | ||
|
|
||
| #include "TianDiTuProvider.h" | ||
| #include "SettingsManager.h" | ||
| #include "AppSettings.h" | ||
|
|
||
| QString TianDiTuProvider::_getURL(int x, int y, int zoom) const | ||
| { | ||
| //"https://t%1.tianditu.gov.cn/DataServer?tk=%2&T=%3&x=%4&y=%5&l=%6" | ||
| const QString tiandituToken = SettingsManager::instance()->appSettings()->tiandituToken()->rawValue().toString(); | ||
| if (!tiandituToken.isEmpty()) { | ||
| return _mapUrl | ||
| .arg(_getServerNum(x, y, 8)) | ||
| .arg(tiandituToken) | ||
| .arg(_mapType) | ||
| .arg(x) | ||
| .arg(y) | ||
| .arg(zoom) | ||
| ; | ||
| } | ||
| return QString(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /**************************************************************************** | ||
| * | ||
| * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
| * | ||
| * QGroundControl is licensed according to the terms in the file | ||
| * COPYING.md in the root of the source code directory. | ||
| * | ||
| ****************************************************************************/ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "MapProvider.h" | ||
|
|
||
| static constexpr const quint32 AVERAGE_TIANDITU_STREET_MAP = 1297; | ||
| static constexpr const quint32 AVERAGE_TIANDITU_SAT_MAP = 19597; | ||
|
|
||
| class TianDiTuProvider : public MapProvider | ||
| { | ||
| protected: | ||
| TianDiTuProvider(const QString &mapName, const QString &mapTypeCode, const QString &imageFormat, quint32 averageSize, | ||
| QGeoMapType::MapStyle mapType) | ||
| : MapProvider(mapName, QStringLiteral("https://map.tianditu.gov.cn/"), imageFormat, averageSize, mapType) | ||
| , _mapType(mapTypeCode) {} | ||
|
|
||
| private: | ||
| QString _getURL(int x, int y, int zoom) const final; | ||
|
|
||
| const QString _mapType; | ||
| const QString _mapUrl = QStringLiteral("https://t%1.tianditu.gov.cn/DataServer?tk=%2&T=%3&x=%4&y=%5&l=%6"); | ||
| }; | ||
|
|
||
| class TianDiTuRoadProvider : public TianDiTuProvider | ||
| { | ||
| public: | ||
| TianDiTuRoadProvider() | ||
| : TianDiTuProvider( | ||
| QObject::tr("TianDiTu Road"), | ||
| QStringLiteral("cia_w"), | ||
| QStringLiteral("png"), | ||
| AVERAGE_TIANDITU_STREET_MAP, | ||
| QGeoMapType::StreetMap) {} | ||
| }; | ||
|
|
||
| class TianDiTuSatelliteProvider : public TianDiTuProvider | ||
| { | ||
| public: | ||
| TianDiTuSatelliteProvider() | ||
| : TianDiTuProvider( | ||
| QObject::tr("TianDiTu Satellite"), | ||
| QStringLiteral("img_w"), | ||
| QStringLiteral("jpg"), | ||
| AVERAGE_TIANDITU_SAT_MAP, | ||
| QGeoMapType::SatelliteMapDay) {} | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The map type code for the road map uses 'cia_w', which is the annotations/labels layer in TianDiTu, not the base road tiles. Use 'vec_w' for the street/vector base layer so the Road provider returns actual base map tiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according the http://lbs.tianditu.gov.cn/server/MapService.html ,
vec_wis 矢量底图(Vector base map), there is no streat name in it.cia_wis 影像注记(Image annotation), there is streat name in it.I don't know much about map development, but we want the road with streat name.
example: use
cia_w, and change 'Road' to a more suitable Provider type, is there any suggestion for it?