Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Gary Sieling:
Scraping Google Maps Search Results with Javascript and PHP
Jul 29, 2013 @ 17:23:21

Gary Sieling has a new post to his site about scraping Google Maps data with a combination of PHP and some simple Javascript. It makes use of callbacks and timers to get the data already returned from their API.

Google Maps provides several useful APIs for accessing data: a geocoding API to convert addresses to latitude and longitude, a search API to provide locations matching a term, and a details API for retrieving location metadata. For many mapping tasks it is valuable to get a large list of locations (restaurants, churches, etc) – since this is valuable, Google places a rate limiter on the information, and encourages caching query results.

He includes the code (both front- and back-end) that you'll need to make the system work. It makes a request to the Google Maps API as usual but then adds a listener with a callback. This takes the latitude/longitude data and runs a "get details" method to get more information. The result is then POSTed to PHP and written out to a file.

tagged: googlemaps google search results scraping api javascript tutorial

Link: http://garysieling.com/blog/scraping-google-maps-search-results-with-javascript-and-php

PPI Framework Blog:
Tutorial: GeoLocation with FourSquare and Google Maps
Jan 28, 2013 @ 19:06:28

On the PPI framework blog there's a recent post showing how to use the framework to create geolocation functionality via an interface with FourSquare and Google Maps.

In this article, we're going to learn how to work with the framework as a whole by writing a real-world application: making a module, controller, routes, templates (views) and services. In order to achieve this we are will use the Foursquare API, and APC for caching the API lookups. We will plot venues from Foursquare in Google Maps for display.

They help you set up a skeleton application and start on creating the "Foursquare Module" along with its controller and views. There's Javascript code included to use the Google Maps functionality and a simple class to work with the FourSquare API to get nearby venues. In the end, you'll have a basic application that maps out the points automatically.

tagged: geolocation foursquare googlemaps tutorial ppiframework

Link:

Internet.com:
Plotting Map Markers Dynamically Using the Google Maps API, jQuery, PHP, and MySQL
Feb 18, 2010 @ 15:44:25

On Internet.com there's a new video tutorial showing you how to work with the Google Maps API and PHP to create a Google map with multiple points plotted from the coordinate data held in a MySQL database. The example doesn't use any sort of framework to get the job done - just straight PHP.

The Google Maps API makes it trivially easy for anybody to create a custom Web-based map, complete with features such as event handlers, route directions, and sophisticated overlays. However, the genesis of many such features stems from your ability to easily add map markers and store the corresponding coordinates within a database such as MySQL.

Unfortunately, there's no link to the sample code, so you'll just have to follow along on-screen. He does make it easy to tie the three technologies together - PHP, MySQL and jQuery - and make a simple multi-point map system. It's flexible too and can be easily extended to include more information in each of the map points (like a name for the location).

tagged: mysql jquery tutorial googlemaps plot

Link:

PHPClasses.org Blog:
Locating addresses on Google Maps embedded in PHP generated Web forms
Nov 04, 2009 @ 18:45:51

On the PHPClasses.org blog there's a new tutorial showing how to use the goe-location support the Google Maps API offers to search for and find an address.

Sometimes it is necessary to get the coordinates of a location on the map. The map location plug-in lets the user point to any location by clicking on the map. [...] However, when the user does not know exactly where is the location he is looking for, it may be painful to find it just by zooming and looking around the map. The latest release of this plug-in makes possible for the users to type the address or name of the city you are looking for and search for the location without further effort.

He uses the form creation package to set up a simple address form (address and country) and a call to its connect() method to link Javascript to the form. When submitted, the new features of the class get to work and ask the Google API for the location and a map is generated with a marker on the spot requested.

tagged: form googleapi googlemaps address search class

Link:

EasyPHPWebsites.com:
Creating a Website Visitor Map (Ajax, jQuery, Google Maps API)
Jun 22, 2009 @ 18:41:29

Jason Gilmore has posted the first tutorial in a series of tutorial combining PHP and jQuery, a look at creating a web site visitor map.

Have you ever wanted to create a map depicting the geographical origin of recent visitors to your website? In this tutorial I'll show you how to record these locations using the Google Ajax Search API, and then use a combination of PHP, MySQL, Ajax, and the Google Maps API to store these locations and build the map.

The tutorial shows how to use the Google Ajax API to locate the current visitor's spot in the world, store it into a MySQL database and then use a jQuery interface to pull the json-formatted details out of the system for display.

tagged: map tutorial jquery googlemaps

Link:

Vancouver Web Consultants Blog:
Getting Time Zone from Latitude & Longitude
May 08, 2009 @ 16:15:30

On the Vancouver Web Consultants blog there's this new tutorial about grabbing latitude and longitude information for a location and determining its current time zone from there.

I was recently tasked with building an application that relied heavily on accurate time zone conversions. I, like many people I soon found out, thought there were just a handful of timezones and the usual select list would suffice. The deeper I looked into the problem, the deeper it got: the list above only shows a few time offsets from UTC, but it doesn't tell me, beyond a shadow of a doubt, exactly what time it is where the user is situated, nor can I rely on that time for calculations in the future. The fact is, here are a LOT of timezones in the world.

He came across the DateTimeZone class PHP has to offer and was happy to see it met his needs. Unfortunately, users weren't always sure what timezone they were in, so he came up with a system combining Google's Maps API and GeoNames.org. He includes the code for both the PHP and Javascript sides (the Javascript requires Mootools, but it could be easily adapted to any other Javascript libraries).

tagged: timezone latitude longitude googlemaps geonames datetimezone

Link:

Developer.com:
Charting Your Course Using the Google Maps API
Apr 15, 2009 @ 22:27:05

Developer.com has posted the latest part in their series on using the Google Maps API. This time they focus on something a bit more complex - working with more than one point and creating complex routes between them.

This installment tackles another fascinating aspect you'll undoubtedly encounter when building location-based solutions, namely distance calculation. Whether you want to simply plot the distance separating two points on the map, or perform more complex operations involving measuring the total distance spanning a more complex route, understanding how to perform these sorts of calculations will prove invaluable time and again.

The tutorial gives you example screenshots and complete code to calculate the distance between two points and, based on plots of a few different points, how to determine the distance traveled. His example is of a running route around a park.

tagged: chart course googlemaps api screenshot tutorial

Link:

PHPImpact Blog:
Server-side Marker Clustering with PHP and Google Maps
Feb 27, 2009 @ 16:25:14

On the PHP::Impact blog Federico Cargnelutti points out a PHP library that lets you do clustering on Google Maps. What's clustering?

As maps get busier, marker clustering is likely to be needed. Marker clustering is a technique by which several points of interest can be represented by a single icon when they’re close to one another.

The tool, created by Mike Tuupola, lets you break up the map into cells and place points inside them. When there's more than one point in a general area, an extra icon is created to reference those points together (cleaning up the map and preventing you from having lot of little Google Maps markers cluttering up your map. Mike also has a blog post about the library showing it in a bit more detail.

tagged: server clustering mark googlemaps miketuupola library combine

Link:

Andreas Gohr's Blog:
A Pirate Map with LibGD and Google Maps
Feb 03, 2009 @ 13:53:41

Andreas Gohr has a fun example of how you can combine the Google mapping technology with the GD rendering image that comes standard with PHP to make "pirate maps" (like this).

Yesterday I thought about visualizing photo geodata. While tinkering with different ideas, I thought about making it look like a real paper photograph placed on a real map. Of course it had to be automated somehow. So I spent a few hours with PHP's GD library functions. It's really cool what you can do with it.

He used a MapDecorate class he put together to create the "treasure map" in a few simple steps - grab the map and convert to sepia, add additional textures/images, add custom text to the bottom and place the selected photo on the map.

tagged: googlemaps gd image library libgd pirate tutorial mapdecorate

Link:

NETTUTS.com:
How to Create a Mashup by Combining 3 Different APIs
Oct 13, 2008 @ 13:40:53

On the NETTUTS website today there's a new tutorial about mashups - specifically showing how to create a sample one by combining three services: Google Maps, the IPloc service and the Beer Mapping Project.

This tutorial will show you how to create a mashup of three different APIs including integration with Google Maps. This idea came about when I was searching through ProgrammableWeb's API directory for a couple APIs that complimented each other enough that I could use one to provide the other with data. What I came up with will be known as the "Beer Mashup".

They include links to scripts to interface easily with the APIs and the sample code you'll need to query against them. They wrap it up with the HTML for the output page (a map showing "beer hot spots" near your area) and the download of the source and demo to give an example of how it should look.

tagged: mashup api googlemaps iploc beer mapping project tutorial

Link:


Trending Topics: