Monday, September 23, 2024

Convert East North Up (ENU) to/from longitude,latitude and other various coordinate systems

 

The Koordinat2 web app (https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html) has been upgraded to perform coordinate transformation between local coordinate system East North Up (ENU) and many other coordinate systems including MGRS, North East Down, ECEF, geographic longitude/latitude, etc. 

This post shows the typical steps to perform the local ENU conversion to other coordinate systems.

Define the ENU local origin 

The local origin should be as near as possible to the area of interest. If it is too far away, the calculation rounding errors would result in erroneous converted coordinates.

  1. Use a browser to open the Koordinat2 web app url (https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html).

    The Koordinat2 web app home page appears.


  2. Click the hamburger menu icon on the top left.

    The Navigation drawer opens.



  3. Click the Settings item.

    The Settings dialog appears.




  4. Choose the item North East Down/East North Up reference origin.

    The NED/ENU Reference Origin appears.



  5. In the dialog, enter the reference origin Longitude, Latitude, and Altitude. Click Save.

    The Reference Origin is saved.

Define ENU as the Primary coordinates (input)

  1. In the Primary coordinates card, click the gear icon.

    The Primary coordinates selection appears.




  2. Select East North Up from the list or search for it by clicking the Search icon and typing in ENU.



Define the Secondary coordinates (output)

  1. In the Secondary coordinates card, click the gear icon.

    The Secondary coordinates selection appears.



  2. Select a desired coordinate system e.g. MGRS from the list or search for it by clicking the Search icon and typing in  MGRS.



Enter ENU coordinates

  1. In the Primary coordinates card, type in the East, North and Up values.

    The ENU values are converted to the secondary coordinates. And a marker appears on the map.






Tuesday, August 13, 2024

Trainsity Metro App


 

Navigate public train networks effortlessly with the Trainsity Metro app's high-resolution vector maps. Choose and download the maps you need, enjoying detailed zoom levels without sacrificing storage space. Access all features offline, without needing an internet connection.

Key Features:

High-Resolution Vector Maps: Crisp, clear maps with multiple zoom levels for detailed viewing.
 

Offline Functionality: Download maps and use them anytime, anywhere, without an internet connection.
 

Interactive Stations: Tap on a train station to open Google Maps, view the surrounding area, and get precise routing directions.


Optimized Travel Planning: Use the offline function to calculate the best routes between stations, complete with step-by-step directions and estimated timings. 

Train timetable: View static train line schedules, frequencies, and the first/last departures at individual stations. 

Note: Actual travel times may vary.

Discover a seamless way to explore train networks with our intuitive and efficient app. 

Available maps:

  1. Singapore
  2. Kuala Lumpur, Malaysia
  3. Sapporo, Japan
  4. Recife, Brazil
  5. Brasilia, Brazil
  6. Vancouver, Canada
  7. Hong Kong, China
  8. Bangkok, Thailand
  9. Manila, Philippines
  10. Osaka, Japan
  11. Amsterdam, Netherlands
  12. Hanoi, Vietnam  
  13. Utrecht, Netherlands
  14. Jakarta, Indonesia 
  15. Rio de Janeiro, Brazil
  16. Palembang, Indonesia
  17. Edmonton, Canada
  18. Calgary, Canada
  19. Sydney, Australia
  20. Fukuoka, Japan
  21. Paris, France
  22. Fortaleza, Brazil
  23. Montreal, Canada
  24. Rome, Italy
  25. Toronto, Canada
  26. Lyon, France
  27. Algiers, Algeria  
  28. São Paulo, Brazil
  29. Perth, Australia
  30. Ho Chi Minh City, Vietnam
  31. Milan, Italy
  32. Nuremberg, Germany 
  33. Copenhagen, Denmark
  34. Sobral, Brazil
  35. Natal, Brazil  
  36. Doha, Qatar
  37. Kaohsiung, Taiwan
  38. Daegu, South Korea 
  39. Busan, South Korea 
  40. Cariri, Brazil 
  41. Taipei, Taiwan 

 Download and try out the Trainsity Metro app from the following stores:

 

Get it on Google Play 

Monday, May 27, 2024

QGIS - Finding location by coordinates

If you need to find specific locations by entering coordinates directly on a map, QGIS offers a handy tool for this purpose. I stumbled upon this feature by chance, and it’s incredibly useful. On the status bar at the bottom of the QGIS interface, there is a field where you can input the desired map coordinates. Here’s how you can use it:

  1. Open QGIS: Start by launching the QGIS application.



  2. Click on the Status Bar Field: Locate the status bar at the bottom left of the screen and click on the input field. A dialog box will pop up.




  3. Enter Coordinates:  Enter the coordinates you want to locate, for example, 3.0584N, 101.566E.



  4. Press ENTER: After typing in the coordinates, hit the ENTER key.

A red circle will blink a few times on the map, indicating the location you specified. This simple yet powerful tool makes it easy to pinpoint exact locations on your map with just a few clicks.


Monday, March 25, 2024

Convert Earth Centered Earth Fixed to/from other coordinate systems with this web app Koordinat2

According to Wikipedia https://en.wikipedia.org/wiki/Earth-centered%2C_Earth-fixed_coordinate_system: in today's modern age of navigation and spatial referencing, there's a key player that often goes unnoticed: the Earth-centered, Earth-fixed coordinate system, more commonly known as ECEF. This sophisticated system, akin to a cosmic GPS, allows us to pinpoint locations with incredible precision. Picture this: a cartesian grid that not only encompasses the Earth's surface but also delves deep into its core, reaches high into the atmosphere, and extends into the surrounding outer space. Through X, Y, and Z measurements from the Earth's center of mass, ECEF opens up a world of possibilities for mapping and exploration.

The WebApp Koordinat2 here on https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html has been enhanced to include conversions between ECEF and various other geo-coordinate systems.  

The following shows how to use convert ECEF to/fro longitude, latitude, altitude WGS84.

Define ECEF as the Primary coordinates (input)

  1. Open a browser to the Koordinat2 web app url https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html.

    The Koordinat2 web app home page is displayed.


  2. In the Primary coordinates input card, click the gear icon.

    The Primary coordinates selection dialog box appears with a list of favorite coordinate systems.



  3. Click the ECEF item from the favorite list, or search for it by clicking the Search icon and typing in ECEF.





Define WGS 84 as the Secondary coordinates (output)

  1. In the Secondary coordinates card, click the gear icon.

    The Secondary coordinates favorites list is displayed.


  2. Click on the WGS 84 item from the favorites list, or click the Search icon and typing in WGS 84 to search for it.



Enter ECEF coordinates

  1. In the Primary coordinates card, type in the X, Y, and Z ECEF values.

    The ECEF values are converted to the secondary WGS 84 coordinates. A marker appears on the map.



Monday, March 18, 2024

Convert North East Down (NED) to/from longitude,latitude and other various coordinate systems

The Koordinat2 web app (https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html) has been upgraded to perform coordinate transformation between local coordinate system North East Down (NED) and many other coordinate systems including MGRS, geographic longitude/latitude, etc. 

This post shows the typical steps to perform the local NED conversion to other coordinate systems.

Define the NED local origin 

The local origin should be as near as possible to the area of interest. If it is too far away, the calculation rounding errors would result in erroneous converted coordinates.

  1. Use a browser to open the Koordinat2 web app url (https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html).

    The Koordinat2 web app home page appears.


  2. Click the hamburger menu icon on the top left.

    The Navigation drawer opens.



  3. Click the Settings item.

    The Settings dialog appears.


  4. Choose the item North East Down reference origin.

    The NED Reference Origin appears.


  5. In the dialog, enter the reference origin Longitude, Latitude, and Altitude. Click Save.

    The Reference Origin is saved.

Define NED as the Primary coordinates (input)

  1. In the Primary coordinates card, click the gear icon.

    The Primary coordinates selection appears.




  2. Select North East Down from the list or search for it by clicking the Search icon and typing in NED.


Define the Secondary coordinates (output)

  1. In the Secondary coordinates card, click the gear icon.

    The Secondary coordinates selection appears.



  2. Select a desired coordinate system e.g. WGS 84 from the list or search for it by clicking the Search icon and typing in  WGS 84.


Enter NED coordinates

  1. In the Primary coordinates card, type in the North, East, and Down values.

    The NED values are converted to the secondary coordinates. And a marker appears on the map.




Monday, February 12, 2024

Deserialize a list of JSON objects using json_annotation and json_serializable in Flutter

I could not find an example of how to read in a list of JSON objects from a file using the Flutter packages: json_annotation and json_serializable. After a while I figured the way to do it. This post shows an example of automating JSON de-serialization of a JSON file that looks like the following:

[
    {
        "code": "NED",
        "fullname": "North East Down (local)",
    },
    {
        "code": "ECEF",
        "fullname": "Earth Centered Earth Fixed (ECEF)",
    },    
    {
        "code": "LLA",
        "fullname": "WGS 84",
    }
]

Install the Flutter packages Json_serializable and Json_annotation

In a Terminal, type in the following:

$ cd /path/to/the/root/of/flutter/project/

$ flutter pub add json_annotation

$ flutter pub add json_serializable

Code the model class dart file

  1. In a text editor, create the model class dart file, e.g. cs_model.dart.

  2. Type in the following:

import 'package:json_annotation/json_annotation.dart';

// Part file to be auto generated
part 'cs_model.g.dart';

@JsonSerializable()
class APICoordSysQuery {

  // Factory method to load in the list of JSON objects
  factory APICoordSysQuery.fromJson(List<dynamic> parsedJson){
    List<APICoordSys> csList = List<APICoordSys>.empty();
    csList = parsedJson.map ( (e) => APICoordSys.fromJson(e)).toList();
    return APICoordSysQuery(
      csList: csList,
    );
  }
  
  // To be auto generated by the Json_serializable package
  Map<String, dynamic> toJson() => _$APICoordSysQueryToJson(this);

  @JsonKey(name: 'csList')
  List<APICoordSys> csList;

  APICoordSysQuery({
    required this.csList
  });
}

@JsonSerializable()
class APICoordSys {
  
  // Factory method to deserialize a JSON object to be auto generated
  factory APICoordSys.fromJson(Map<String, dynamic> json) =>
    _$APICoordSysFromJson(json);
  
  // Factory method to serialize a JSON Object to be auto generated
  Map<String, dynamic> toJson() => _$APICoordSysToJson(this);

  @JsonKey(name: 'code')
  String code;
  @JsonKey(name: 'fullname')
  String fullName;

  // Constructor
  APICoordSys({
    required this.code,
    required this.fullName
  });
}

Generate the .part file

  1. In a Terminal, run the following:

    $ cd /path/to/flutter/root/project/
    $ dart run build_runner build


    Processing messages appear and the cs_model.part.g.dart file is generated.

Now you should be able to load in a list of JSON objects in Flutter.

 

Monday, November 27, 2023

How I fixed the Android Studio current target and jvm target compatibility error

I encountered the following compilation error in Android Studio of one of my Android project about current target JVM compatibility (or incompatibility), as shown in the screenshot message listing below:

 

Execution failed for task ':app:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

I managed to fix the problem by ensuring the source and target are compatible, i.e. having the same Java version.

To fix the issue:

  1. In Android Studio, select File | Project Structure.

    The Project Structure dialog box appears.


  2. Click Gradle Settings.

    The Gradle dialog box appears.


  3. In the Use Gradle from combo box, choose 'gradle-wrapper.properties' file.

  4. In the Gradle JDK combo box, choose jbr-17 JetBrains Runtime version 17.

  5. Click OK to close all dialog boxes.

  6. In Android Studio, open the app's build.gradle file in the editor.


  7. Within the android construct, add in the compileOptions as shown in the listing below.

android {
    compileSdk 33

// ...etc...

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
}

From this point on, compiling the app should not throw upany  JVM target compatibility errors.