I don‘t see your problem… it works exactly how it should… it converts a location to a position on your screen. Try using a value very close to your Center Location and you‘ll see that it will return a value between 0, 0 and 1000, 1000 (the extent of your screen).
I’d like to do an animation of markers on the screen. Now, the markers even do not show up, because the left upper corner is (0,0) in the coordinate system and the marker I intended to draw has position (-687.0, -2279.0). So I might need to try it out by updating the latitude and longitude of the center of the map and also the size of the map. I was wondering, is there any other way around instead of trying out. Thank you for your reply.
Not fully sure I understand what you are trying to achieve. But you could start by simply zooming out, either interactively, or use a zoom_start of e.g. 3 so the location of 67,17 is within the visible map area.
If you want to ensure the locations are on the visible map area, you could also create a Marker with that location and then use map.zoomAndPanToFit(myMarker) or, if multiple markers, map.zoomAndPanToFitMarkers(myMarkersList).