mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-27 11:00:31 -04:00 
			
		
		
		
	Map: Add World Magnetic Model data and show magnetic declination on map.
This commit is contained in:
		
							parent
							
								
									d834c363b3
								
							
						
					
					
						commit
						1aeac6e268
					
				| @ -8,3 +8,16 @@ French transmitter data: | ||||
| 
 | ||||
| sites-DAB-TII-v0.10.csv - https://extranet.arcom.fr/radio/index.php | ||||
| 
 | ||||
| 
 | ||||
| WMM (World Magnetic Model): | ||||
| 
 | ||||
| Download ERSI shapefiles from: https://data.ngdc.noaa.gov/geomag/wmm/wmm2025/shapefiles/ | ||||
| Open D_2025.shp in QGIS: https://qgis.org/ | ||||
| Layer > Open Attribute Table, Toggle Edit Mode, Delete unneeded contours (E.g. odd values). | ||||
| Edit > Edit Geometry > Simplify feature, Draw box around all geometry, set tolerance to 0.1 and check reduction in number of verticies. | ||||
| Layer > Save As... | ||||
| 
 | ||||
| QGIS geojson export doesn't support styles (See: https://github.com/qgis/QGIS/issues/21195) so manually edit the geojson and insert: | ||||
| 
 | ||||
|     "stroke": "#ff0000" properties to set color. Negative blue, positive red, 0 green. | ||||
|     "stroke-width": 0.5,  for contours that aren't multiples of 10 and 1.0 for those that are. | ||||
|  | ||||
							
								
								
									
										187
									
								
								plugins/feature/map/data/wmm.geojson
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										187
									
								
								plugins/feature/map/data/wmm.geojson
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										44
									
								
								plugins/feature/map/data/wmm.qmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								plugins/feature/map/data/wmm.qmd
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | ||||
| <!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'> | ||||
| <qgis version="3.42.1-Münster"> | ||||
|   <identifier>D_2025</identifier> | ||||
|   <parentidentifier></parentidentifier> | ||||
|   <language>ENG</language> | ||||
|   <type>dataset</type> | ||||
|   <title>D_2025</title> | ||||
|   <abstract></abstract> | ||||
|   <contact> | ||||
|     <name></name> | ||||
|     <organization></organization> | ||||
|     <position></position> | ||||
|     <voice></voice> | ||||
|     <fax></fax> | ||||
|     <email></email> | ||||
|     <role></role> | ||||
|   </contact> | ||||
|   <links/> | ||||
|   <dates/> | ||||
|   <fees></fees> | ||||
|   <encoding></encoding> | ||||
|   <crs> | ||||
|     <spatialrefsys nativeFormat="Wkt"> | ||||
|       <wkt>GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],MEMBER["World Geodetic System 1984 (G2296)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]</wkt> | ||||
|       <proj4>+proj=longlat +datum=WGS84 +no_defs</proj4> | ||||
|       <srsid>3452</srsid> | ||||
|       <srid>4326</srid> | ||||
|       <authid>EPSG:4326</authid> | ||||
|       <description>WGS 84</description> | ||||
|       <projectionacronym>longlat</projectionacronym> | ||||
|       <ellipsoidacronym>EPSG:7030</ellipsoidacronym> | ||||
|       <geographicflag>true</geographicflag> | ||||
|     </spatialrefsys> | ||||
|   </crs> | ||||
|   <extent> | ||||
|     <spatial dimensions="2" minz="0" maxx="-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368" maxy="-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368" minx="179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368" crs="EPSG:4326" maxz="0" miny="179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368"/> | ||||
|     <temporal> | ||||
|       <period> | ||||
|         <start></start> | ||||
|         <end></end> | ||||
|       </period> | ||||
|     </temporal> | ||||
|   </extent> | ||||
| </qgis> | ||||
							
								
								
									
										
											BIN
										
									
								
								plugins/feature/map/icons/compass.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								plugins/feature/map/icons/compass.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 3.5 KiB | 
| @ -1,5 +1,6 @@ | ||||
| <RCC> | ||||
|   <qresource prefix="/map/"> | ||||
|     <file>data/transmitters.csv</file> | ||||
|     <file>data/wmm.geojson</file> | ||||
|   </qresource> | ||||
| </RCC> | ||||
|  | ||||
| @ -1814,6 +1814,7 @@ void MapGUI::displayToolbar() | ||||
|     ui->displayNASAGlobalImagery->setVisible(overlayButtons); | ||||
|     ui->displayMUF->setVisible(!narrow && m_settings.m_map3DEnabled); | ||||
|     ui->displayfoF2->setVisible(!narrow && m_settings.m_map3DEnabled); | ||||
|     ui->displayMagDec->setVisible(!narrow && m_settings.m_map3DEnabled); | ||||
|     ui->save->setVisible(m_settings.m_map3DEnabled); | ||||
| } | ||||
| 
 | ||||
| @ -1923,6 +1924,7 @@ void MapGUI::applyMap3DSettings(bool reloadMap) | ||||
|         m_cesium->getDateTime(); | ||||
|         m_cesium->showMUF(m_settings.m_displayMUF); | ||||
|         m_cesium->showfoF2(m_settings.m_displayfoF2); | ||||
|         m_cesium->showMagDec(m_settings.m_displayMagDec); | ||||
|         m_cesium->showLayer("rain", m_settings.m_displayRain); | ||||
|         m_cesium->showLayer("clouds", m_settings.m_displayClouds); | ||||
|         m_cesium->showLayer("seaMarks", m_settings.m_displaySeaMarks); | ||||
| @ -2012,6 +2014,7 @@ void MapGUI::init3DMap() | ||||
| 
 | ||||
|     m_cesium->showMUF(m_settings.m_displayMUF); | ||||
|     m_cesium->showfoF2(m_settings.m_displayfoF2); | ||||
|     m_cesium->showMagDec(m_settings.m_displayMagDec); | ||||
| 
 | ||||
|     m_cesium->showLayer("rain", m_settings.m_displayRain); | ||||
|     m_cesium->showLayer("clouds", m_settings.m_displayClouds); | ||||
| @ -2063,6 +2066,7 @@ void MapGUI::displaySettings() | ||||
|     m_displayMUF->setChecked(m_settings.m_displayMUF); | ||||
|     ui->displayfoF2->setChecked(m_settings.m_displayfoF2); | ||||
|     m_displayfoF2->setChecked(m_settings.m_displayfoF2); | ||||
|     ui->displayMagDec->setChecked(m_settings.m_displayMagDec); | ||||
|     m_objectMapModel.setDisplayNames(m_settings.m_displayNames); | ||||
|     m_objectMapModel.setDisplaySelectedGroundTracks(m_settings.m_displaySelectedGroundTracks); | ||||
|     m_objectMapModel.setDisplayAllGroundTracks(m_settings.m_displayAllGroundTracks); | ||||
| @ -2362,6 +2366,34 @@ void MapGUI::on_displayfoF2_clicked(bool checked) | ||||
|     if (m_cesium && !m_settings.m_displayfoF2) { | ||||
|         m_cesium->showfoF2(m_settings.m_displayfoF2); | ||||
|     } | ||||
| void MapGUI::on_displayMagDec_clicked(bool checked) | ||||
| { | ||||
|     if (this->sender() != ui->displayMagDec) { | ||||
|         ui->displayMagDec->setChecked(checked); | ||||
|     } | ||||
|     if (this->sender() != m_displayMagDec) { | ||||
|         m_displayMagDec->setChecked(checked); | ||||
|     } | ||||
|     m_settings.m_displayMagDec = checked; | ||||
|     if (m_cesium) { | ||||
|         m_cesium->showMagDec(m_settings.m_displayMagDec); | ||||
|     } | ||||
|     applySetting("displayMagDec"); | ||||
| } | ||||
| 
 | ||||
| void MapGUI::on_displayMaidenheadGrid_clicked(bool checked) | ||||
| { | ||||
|     if (this->sender() != ui->displayMaidenheadGrid) { | ||||
|         ui->displayMaidenheadGrid->setChecked(checked); | ||||
|     } | ||||
|     if (this->sender() != m_displayMaidenheadGrid) { | ||||
|         m_displayMaidenheadGrid->setChecked(checked); | ||||
|     } | ||||
|     m_settings.m_displayMaidenheadGrid = checked; | ||||
|     if (m_cesium) { | ||||
|         m_cesium->showMaidenheadGrid(m_settings.m_displayMaidenheadGrid); | ||||
|     } | ||||
|     applySetting("displayMaidenheadGrid"); | ||||
| } | ||||
| 
 | ||||
| void MapGUI::createLayersMenu() | ||||
| @ -2406,6 +2438,10 @@ void MapGUI::createLayersMenu() | ||||
|     m_displayfoF2->setToolTip("Display F2 layer critical frequency contours"); | ||||
|     connect(m_displayfoF2, &QAction::triggered, this, &MapGUI::on_displayfoF2_clicked); | ||||
| 
 | ||||
|     m_displayMagDec = menu->addAction("Mag Dec"); | ||||
|     m_displayMagDec->setCheckable(true); | ||||
|     m_displayMagDec->setToolTip("Display magnetic declination"); | ||||
|     connect(m_displayMagDec, &QAction::triggered, this, &MapGUI::on_displayMagDec_clicked); | ||||
|     ui->layersMenu->setMenu(menu); | ||||
| } | ||||
| 
 | ||||
| @ -2880,6 +2916,7 @@ void MapGUI::makeUIConnections() | ||||
|     QObject::connect(ui->nasaGlobalImageryOpacity, qOverload<int>(&QDial::valueChanged), this, &MapGUI::on_nasaGlobalImageryOpacity_valueChanged); | ||||
|     QObject::connect(ui->displayMUF, &ButtonSwitch::clicked, this, &MapGUI::on_displayMUF_clicked); | ||||
|     QObject::connect(ui->displayfoF2, &ButtonSwitch::clicked, this, &MapGUI::on_displayfoF2_clicked); | ||||
|     QObject::connect(ui->displayMagDec, &ButtonSwitch::clicked, this, &MapGUI::on_displayMagDec_clicked); | ||||
|     QObject::connect(ui->find, &QLineEdit::returnPressed, this, &MapGUI::on_find_returnPressed); | ||||
|     QObject::connect(ui->maidenhead, &QToolButton::clicked, this, &MapGUI::on_maidenhead_clicked); | ||||
|     QObject::connect(ui->save, &QToolButton::clicked, this, &MapGUI::on_save_clicked); | ||||
|  | ||||
| @ -252,6 +252,7 @@ private: | ||||
|     QAction *m_displayNASAGlobalImagery; | ||||
|     QAction *m_displayMUF; | ||||
|     QAction *m_displayfoF2; | ||||
|     QAction *m_displayMagDec; | ||||
| 
 | ||||
|     QString m_radarPath; | ||||
|     QString m_satellitePath; | ||||
| @ -330,6 +331,7 @@ private slots: | ||||
|     void on_displayNASAGlobalImagery_clicked(bool checked=false); | ||||
|     void on_nasaGlobalImageryIdentifier_currentIndexChanged(int index); | ||||
|     void on_nasaGlobalImageryOpacity_valueChanged(int index); | ||||
|     void on_displayMagDec_clicked(bool checked=false); | ||||
|     void on_layersMenu_clicked(); | ||||
|     void on_find_returnPressed(); | ||||
|     void on_maidenhead_clicked(); | ||||
|  | ||||
| @ -14,5 +14,6 @@ | ||||
|         <file>icons/railway.png</file> | ||||
|         <file>icons/waypoints.png</file> | ||||
|         <file>icons/earthsat.png</file> | ||||
|         <file>icons/compass.png</file> | ||||
|     </qresource> | ||||
| </RCC> | ||||
|  | ||||
| @ -216,6 +216,13 @@ void MapSettings::resetToDefaults() | ||||
|     m_displayNASAGlobalImagery = false; | ||||
|     m_nasaGlobalImageryIdentifier = ""; | ||||
|     m_nasaGlobalImageryOpacity = 50; | ||||
|     m_displayAurora = false; | ||||
|     m_displayMagDec = false; | ||||
|     m_displayMaidenheadGrid = false; | ||||
|     m_displayPFD = false; | ||||
|     m_viewFirstPerson = false; | ||||
|     m_defaultImagery = "Sentinel-2"; | ||||
|     m_arcGISAPIKey = ""; | ||||
|     m_workspaceIndex = 0; | ||||
|     m_checkWXAPIKey = ""; | ||||
| } | ||||
| @ -354,6 +361,7 @@ bool MapSettings::deserialize(const QByteArray& data) | ||||
|         d.readBool(41, &m_displayNASAGlobalImagery, false); | ||||
|         d.readString(42, &m_nasaGlobalImageryIdentifier, ""); | ||||
|         d.readS32(43, &m_nasaGlobalImageryOpacity, 50); | ||||
|         d.readBool(45, &m_displayMagDec, false); | ||||
| 
 | ||||
|         d.readString(46, &m_checkWXAPIKey, ""); | ||||
| 
 | ||||
| @ -626,6 +634,9 @@ void MapSettings::applySettings(const QStringList& settingsKeys, const MapSettin | ||||
|     if (settingsKeys.contains("nasaGlobalImageryOpacity")) { | ||||
|         m_nasaGlobalImageryOpacity = settings.m_nasaGlobalImageryOpacity; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMagDec")) { | ||||
|         m_displayMagDec = settings.m_displayMagDec; | ||||
|     } | ||||
|     if (settingsKeys.contains("workspaceIndex")) { | ||||
|         m_workspaceIndex = settings.m_workspaceIndex; | ||||
|     } | ||||
| @ -734,6 +745,9 @@ QString MapSettings::getDebugString(const QStringList& settingsKeys, bool force) | ||||
|     if (settingsKeys.contains("nasaGlobalImageryOpacity") || force) { | ||||
|         ostr << " m_nasaGlobalImageryOpacity: " << m_nasaGlobalImageryOpacity; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMagDec") || force) { | ||||
|         ostr << " m_displayMagDec: " << m_displayMagDec; | ||||
|     } | ||||
|     if (settingsKeys.contains("workspaceIndex") || force) { | ||||
|         ostr << " m_workspaceIndex: " << m_workspaceIndex; | ||||
|     } | ||||
|  | ||||
| @ -110,6 +110,7 @@ struct MapSettings | ||||
|     bool m_displayNASAGlobalImagery; | ||||
|     QString m_nasaGlobalImageryIdentifier; | ||||
|     int m_nasaGlobalImageryOpacity; | ||||
|     bool m_displayMagDec; | ||||
| 
 | ||||
|     QString m_checkWXAPIKey;    //!< checkwxapi.com API key
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user