If you’d like to show actual address as in street name/number you should use reverse geo coding api https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding basically its something like http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false which you should probably on publish/save post (not on every page load).
If you just like to show the markers on the map, I did something similar a couple of years ago with some code to looks very similar to yours (custom markers/info-pains), my locations array looks like so:
<?php
if ( $places_query->have_posts() ) {
while ( $places_query->have_posts() ) {
$places_query->the_post();
$user_location['lat'] = get_post_meta( $post->ID, 'geo_latitude', true );
$user_location['lng'] = get_post_meta( $post->ID, 'geo_longitude', true );
$places[] = $user_location;
}
}
?>
and the actual array:
<script type="text/javascript">
places = <?php echo json_encode($places); ?>; //places is your var locations
</script>
so the difference is that I’m doing json_encode
to the array which is sent to the maps rendering function.
Hope that helps!