How to change from Google Map API to OneMap API?

Currently the website is build on gmap api with retrieval of data (e.g. latitude and longitude) from fusiontable and I want to adapt into onemap. I went through the documentation page but I do not understand how to embed the static map into html as it was given as a link and how to get points on the static map.

@eddieleow The static map is a GET request which returns an image. Thus, you likely can’t obtain points on the static map through user interaction without some hacks.

The response is returned in PNG format in accordance to the parameter inputs. Users can also create personalised static maps via the Static Map Creator.

Using the static map API

Click link to see map image: https://developers.onemap.sg/commonapi/staticmap/getStaticImage?layerchosen=default&lat=1.31955&lng=103.84223&zoom=17&height=512&width=512

You can use this in an image tag like so:

1 Like

For the static map, it requires latitude and longitude coordination in which I only have Singapore postal codes. Is there a way to convert postal codes into latitude and longtitude?

PS. I have more than one postal codes which I would like to mark in the map.

1 Like

@eddieleow Use the search API. It’s works well with postal codes

GET request: https://developers.onemap.sg/commonapi/search?searchVal=608838&returnGeom=N&getAddrDetails=Y&pageNum=1

2 Likes

Hi Edwin,

This is absolutely right. You can get your points directly from the search results.

Btw, we have a minimap creator too…(Sneak-Peek: Advanced Minimap is coming! In the new version, you could drop multiple points with nice icons!)

https://tools.onemap.sg/minimap/

Regards,
Kai

1 Like

I got it! Thank you. Deeply appreciate that! @edwinchua @kaicong

1 Like