Giter VIP home page Giter VIP logo

cakeosm's Introduction

CakeOSM

Helper to use OpenStreetMap (OSM) with CakePHP

Installation

  • Clone/Copy the files in this directory into app/Plugin/DebugKit
git submodule add https://github.com/h4ck3rm1k3/CakeOSM.git app/Plugin/CakeOSM
``
* Ensure the plugin is loaded in `app/Config/bootstrap.php` 
```php
/*
  OSM plugin:
*/
CakePlugin::load('CakeOSM');

  • Include the helper in your app/Controller/SomeController.php:
class SomeController extends Controller {

/**
 * Helpers
 *
 * @var array
 */
	public $helpers = array('CakeOSM.OpenLayers');

}

Example use: Following was translated from http://cakeosm.javiermaties.com/

Its use is very simple, you download the helper and installed in cakephp app is activated, the best way is from the AppController and is called from any view as follows:

  echo $this->OpenLayers->map($default, $style = 'width:100%; height: 100%', $map_type);

$default is an array with the following possible values:

  • 'Typecloud' -> map style
  • 'Zoom' -> map zoom
  • 'Lat' => latitude of the map center
  • 'Long' -> length of the center of the map

And $map_type (type) would have these possible values:

  • NULL (for use directly openlayers)
  • CloudMade
  • leaflet

Also is prepared to receive points of interest (POI), let the "markers" of GoogleMaps:

  echo $this->OpenLayers->addmarkers($marker,null,$map_type);

Where $marker is an array with the point and with these settings:

  • lat - latitude of the point
  • long - longitude length
  • title - the title that appears in infowindow

($map_type)Type must be the same variable as before, with the same value.

cakeosm's People

Contributors

jmaties avatar h4ck3rm1k3 avatar

Stargazers

al3c avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.