Shoud I preload latlng or go with an address?

32 views
Skip to first unread message

edshuck

unread,
Nov 4, 2011, 11:30:16 PM11/4/11
to google-map...@googlegroups.com
Mine is a neighborhood site.  About 500 shops/schools/and such. 
For anyone with a site, I link to the site.
The others are low impact users - laundry/nail salon/ mom and pop grocery stores.  These folks will have a "page" with limited individuality.  But I want to put a couple of photos, some comments from the owner and a google map on the page.
I can load a latlng (stored in mysql) using php.  I have tried it and it works - code at the bottom.
But the question is "Would this be useful"?  Or should I go with the address and use the geocoder?
The shop table has name, address, city, state, zip and more.  I can add one more column for the latlng.  Which way?
Thanks!
 
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /><?php
$LatLng=('37.7535, -122.4372');
?>
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0; padding: 0 }
  #map_canvas { height: 100% }
</style>
<script type="text/javascript"
    src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
  function initialize() {
    var latlng = new google.maps.LatLng(<?php echo($LatLng); ?>);
    var myOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.TERRAIN
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
  }

</script>
</head>
<body onload="initialize()">
  <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>  



Andrew Leach

unread,
Nov 5, 2011, 7:49:42 PM11/5/11
to google-map...@googlegroups.com
On 5 November 2011 03:30, edshuck <eds...@noevalley.com> wrote:
> But the question is "Would this be useful"?  Or should I go with the address
> and use the geocoder?
> The shop table has name, address, city, state, zip and more.  I can add one
> more column for the latlng.  Which way?

Always, always store the coordinates once you have found them
(provided that they are going to be used on a Google map). It's far
more efficient, far quicker and leaves geocoder resources for those
who do actually need them. Another reason is that geocoders guess, and
changes to the software can alter guesses: what's right one day may be
wrong the next; or it may never get it exactly right. Store the
correct position and have done with it!

I suggest two columns, though: latitude and longitude.

edshuck

unread,
Nov 5, 2011, 11:33:56 PM11/5/11
to google-map...@googlegroups.com
Andrew,
Thanks for the reply.
I will follow each item of advice.   is, as you suggest, best.
Thanks again -

Peace

ed

edshuck

unread,
Nov 5, 2011, 11:36:19 PM11/5/11
to google-map...@googlegroups.com
I get verbose.  Missed some deletes.  Sorry  ed
Reply all
Reply to author
Forward
0 new messages