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

OpenShift Blog:
Open Source Mapping with PHP and MongoDB
Nov 06, 2013 @ 19:47:38

On the OpenShift blog Ryan Jarvinen has a new tutorial showing you how to use MongoDB and Silex to create a basic mapping service. It takes advantage of the MongoDB spatial data and query functionality to help locate and map items from the dataset.

Whether your goals are civic-minded or otherwise, PHP can help you craft solutions that are every bit as simple and elegant as what you might expect to see from modern Python, Ruby, or JavaScript frameworks. This particular example is intended to serve as a reusable template for folks who are interested in producing their own mapping applications - substituting in their own collection of map points or other spatial data.

He starts with a look at the datastore - the MongoDB - and the kind of data it will contain. He's shared the dataset (and complete example code too) over on Github and includes the command to import it. He then starts in on the PHP side of things, showing you how to get Silex installed and add in some basic routes and CSS. He then uses the Leaflet.js library to import the data and drop it into an Openstreetmap-based map. The full code and data can be found in this repository over on Github.

tagged: mapping mongodb leafletjs tutorial openstreetmap

Link: https://www.openshift.com/blogs/open-source-mapping-with-php-and-mongodb

PHPMaster.com:
Mapping with Geocoder PHP and Leaflet.js
Nov 06, 2013 @ 16:49:43

On PHPMaster.com a new tutorial has been posted showing how to combine Geocoder PHP with Leaflet.js to create interactive maps. The Leaflet.js library lets you easily create mobile-friendly maps with simplicity and usability in mind.

Interactive maps inside a web application have a lot of great uses. From visualizing data to highlighting points of interest, maps are expected to communicate ideas within the context of location easily. The hardest part, however, is converting that data into coordinates that the map can understand. Luckily, Geocoder PHP allows us to connect to different geo-coding providers. Combined with Leaflet.js, a simple Javascript library, creating maps is a breeze.

He starts by helping you get the Geocoder library installed via Composer and make a sample page (using Bootstrap and jQuery) with a container for the map. He helps you set up Geocoder with an adapter to connect to the service of your choice (like Google Maps, Bing Maps or Openstreatmap). With this configured and created, he inputs some sample data and coverts the addresses to latitude/longitude sets. He walks you through getting Leaflte.js added to the page and pulling in these results via individual generated Javascript variables. You can check out a demo of the end result to see how it all fits together too.

tagged: mapping geocoder leafletjs tutorial introduction interactive

Link: http://www.sitepoint.com/mapping-geocoder-php-leaflet-js/


Trending Topics: