[GIS] how to convert latitude, longitude projection from epsg:3857 to epsg:4326

coordinate systemgeocodinggeoservergoogle-maps-apiopenlayers-2

I want to use geocode in our application. so that, I got Google geocoding API and could achieve with Google Maps.
Problem is that I wanted to achieve the same with my own map which is having projection EPSG:4326 INSTEAD OF getting geocoded from Google Map which is having projection EPSG:3857.
or
I am getting a coordinates from Google geocoding projection EPSG:3857 and that
coordinates I want to mark on my OpenLayers Map which is having projection EPSG:4326

please help me.

Best Answer

The following piece of code allows you to transform your latitude and longitude coordinates from epsg:3857 to epsg:4326 in just one line. Just substitute longitude and latitudine values to LON and LAT in the code.

point = new OpenLayers.LonLat(LON,LAT).transform('EPSG:4326', 'EPSG:3857');

In point you'll have an OpenLayers readable point.