[GIS] OpenLayers map with Nominatim lookup function not working

javascriptnominatimopenlayers-2

I am trying to create a simple map with a search function, my minimal example is here: http://jsfiddle.net/TimLucas/vbaupe30/4/

For some reason the coords transformation after the script has received data from nominatim from EPSG 4326 to EPSG 3857 does not work well, even though it does work in an earlier instance in the script (right at the beginning).I have stepped through the function and the x – coord seems to be fine but the y – coord is wildly off.

Has anyone encountered a similar problem?

Best Answer

So the awnser turned out to be pretty easy, the ol.proj.transform() function needs numbers and not string (and apparently does not automatically convert these strings). So a simple Number() around the arguments sufficed. Here is the working fiddle:

http://jsfiddle.net/TimLucas/vbaupe30/5/