{"id":315,"date":"2005-08-21T01:17:14","date_gmt":"2005-08-21T00:17:14","guid":{"rendered":"http:\/\/wp.devco.net\/?p=315"},"modified":"2014-12-26T22:26:21","modified_gmt":"2014-12-26T21:26:21","slug":"google_maps_and_php","status":"publish","type":"post","link":"https:\/\/www.devco.net\/archives\/2005\/08\/21\/google_maps_and_php.php","title":{"rendered":"Google Maps and PHP"},"content":{"rendered":"
I’ve kept a map of my travels since around 1999, I used to use the now defunct PARC Xerox Map Viewer<\/a>, when that went away I started just projecting dots onto XPlanet<\/a> maps to produce a static map<\/a>.<\/p>\n Ever since Google<\/a> introduced their Google Maps<\/a> system a number of mapping tools became available, dedicated blogs have been written like the very good Google Maps Mania<\/a> and I’ve been thinking of trying to do my map using that instead.<\/p>\n Gary<\/a> got hold of some code which got me going but it was a bit of a PITA so some searching brought me to Google Maps EZ<\/a> which is basically a javascript library that takes standard HTML HREF’s and turns them into points etc, very easy to use.<\/p>\n My problem was still that maintaining data in a html file of HREF’s isn’t exactly what I had in mind, I was more partial to a XML file like the sample below:<\/p>\n This contains a lot of information, the type of visit I made to the location, links to my images taken there, a thumbnail to show for the links etc it wouldn’t be great to automate the parsing of that to output the HTML for GMapsEZ?<\/p>\n So that is exactly what I wrote. My script takes a simple configuration file like the one below:<\/p>\n By calling the script I wrote and passing the config file as argument it will produce all the HTML GMapsEZ needs to do its magic.<\/p>\n And this is the map it will produce, this is just a screenshot of the final result, see below the image for a link to the full working page.<\/p>\n My full working version of the map can be seen here<\/a>, it’s the same data as above just a much bigger map, bigger controls and a different extend. The only actual difference are some changes to the config file, same data and same PHP code was used.<\/p>\n I’ve set up a Wiki<\/a> to maintain documentation for this as it matures over time, I will make announcements of new features on this blog, but the Wiki<\/a> will be the resource that contains a always up to date reference to features and installation. You can read about obtaining, configuring and using this script there<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" I’ve kept a map of my travels since around 1999, I used to use the now defunct PARC Xerox Map Viewer, when that went away I started just projecting dots onto XPlanet maps to produce a static map. Ever since Google introduced their Google Maps system a number of mapping tools became available, dedicated blogs […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","footnotes":""},"categories":[7],"tags":[121,57,50,42],"_links":{"self":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/315"}],"collection":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/comments?post=315"}],"version-history":[{"count":4,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":3065,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/315\/revisions\/3065"}],"wp:attachment":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/media?parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/categories?post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/tags?post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\r\n
\r\n[map]\r\ndata = visited.xml\r\ntype = map\r\nextend = \"http:\/\/maps.google.com\/maps?ll=51.964577,-1.241455&spn=3.460112,7.639893&hl=en\"\r\nwidth = 350\r\nheight = 200\r\nshowcountry = 1\r\nshowtype = 0\r\n[controls]\r\nmapctrl = 1\r\ntypectrl = 1\r\nscalectrl = 0\r\nsize = small\r\n[types]\r\nvisit = orange\r\ntransit = blue\r\nlived = green\r\n[misc]\r\ngmapez=http:\/\/www.devco.net\/visited\/gmapez.js\r\napikey=\"mykey\"\r\n<\/pre>\n
\r\n\r\nrequire_once(\"gmap.inc.php\");\r\nprint(getGMapEZ(\"smalldemo.cfg\"));\r\n?>\r\n<\/pre>\n