1

I am currently having some problem with the spatial reference projection on the map in Android.

Basically I have a base map which is OneMap and all the coordinates stored in database is in SVY21 format. However, I wanted to display it using GoogleMap which is in WGS84 format. I wonder is there any ways for me to convert it in Java?

Because by using OneMap Api Documentation, it has a conversion method which is in JavaScript. However, I need it to be in Java for my Android project. Any ideas?

  • The link you have lists two services that are using EPSG:3857 ("Web Mercator"). Can you use one of those instead? – mkennedy Dec 26 '14 at 14:34
  • @mkennedy Sorry but what do you mean? – 20 Cents Dec 26 '14 at 15:37
  • I probably misunderstood (again; brain on holiday is broken). You've got coordinates in SVY21 and you want to display them with Google Map data/base map? But what about the OneMap base map? I guess I'm wondering if you can expand about what different data types you have. – mkennedy Dec 26 '14 at 19:51
  • @mkennedy Yeah, that's exactly what I am trying to do. I have to use GoogleMap because I do not think OneMap support heatmap and clustermap in Android – 20 Cents Dec 27 '14 at 1:47
2

You are now not to worry about this SVY21 Projection conversion (From 3414 To EPSG:3857/EPSG:4326) for OneMap. The New OneMap basemaps support WGS84 format.

New OneMap: API Documentation (Co-Ordinates Converter - SVY21 to EPSG:3857)

New OneMap: API Documentation (Co-Ordinates Converter - SVY21 to EPSG:4326)

New OneMap: API Documentation (BaseMap)

1

The obvious option for this task is GeoTools. It includes a few JTS utility classes such as Transform and Convert that work on objects of the Geometry type.

You may wish to follow the Geometry CRS Tutorial for a first contact with this aspect of the library.

  • Geotool CRS class uses RenderingHints awt which is not compatible with Android. Are you sure this is a valid proposal? – George Oct 31 '17 at 17:44
1

If you just want to do coordinate transformation you can use CTS library on android.

This is a lightweight library written fully in Java.

Coordinate Transformation Suite (abridged CTS) is a library developed to perform coordinate transformations using well known geodetic algorithms and parameter sets.

CTS handles 4257 coordinate reference systems (3910 EPSG).

The source code of this project is located at:

https://github.com/irstv/CTS

You can also use an embedded spatial database on android called H2GIS.

http://h2gis.org

You can query and make on the fly conversion of coordinates

-- Store points of interest in EPSG 3414 (SVY21 / Singapore TM)
CREATE TABLE POI(THE_GEOM POINT);
INSERT INTO POI VALUES (ST_GEOMFROMTEXT('POINT(5000 12000)',3414));
-- Query and convert into EPSG 4326 WGS84
SELECT ST_TRANSFORM(THE_GEOM ,4326) THE_GEOM FROM POI;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.