Openlayers-3 setCenter is not working

المشرف العام

Administrator
طاقم الإدارة
I'm trying to set the center (setCenter) of the map from a JSON coordinate that comes in form Genomes using ui.autocomplete. I'm using the openlayers default proj of EPSG:3857, so to get the coordinates to plot, I'm using fromLongLat like so:

var lng = (ui.item.lng);var lat = (ui.item.lat);var location = ol.proj.fromLonLat([lng, lat]);var a = map.getView();a.setCenter(location);a.setZoom(14);The problem is that it's not reprojecting the coordinates properly. It keeps messing up the latitude.

it takes [-95.36327, 29.76328]and makes it [-10615790.656781463,-8452628.599925281] (which is -95.36327, -60.2367112)

Why is it messing up the latitude??



أكثر...
 
أعلى