Giter Site home page Giter Site logo

hypemapsopen's Introduction

hypeMapsOpen for Elgg

Elgg 2.3

API and UI for maps built with open technology

Screenshots

User Map

Acknowledgements

Features

  • Geocoding and reverse geocoding via Nominatim
  • Maps built with Leaflet.js
  • Default map tiles provided by Open Street Maps (customizagle in views)
  • User map
  • Groups map
  • Group members map

Usage

A map of arbitrary locations

echo elgg_view('page/components/map', [
	'markers' => [
		'Berlin, Germany',
		'London, UK',
		'Paris, France',
	]
]);

A map with custom icons

$berlin = hypeJunction\MapsOpen\Marker::fromLocation('Berlin, Germany');
$berlin->icon = 'smile-o';
$berlin->color = 'green';
$berlin->tooltip = '<b>Berlin is a happy place</b>';

$paris = hypeJunction\MapsOpen\Marker::fromLocation('Paris, France');
$paris->icon = 'coffee';
$paris->color = 'black';
$paris->tooltip = '<img src="https://s-media-cache-ak0.pinimg.com/736x/ca/ea/57/caea57268e1dee696f3c20a5a0f895f2.jpg" alt="Paris" />';

echo elgg_view('page/components/map', [
	'markers' => [
		$berlin,
		$paris,
	],
		]);

A map of entities

echo elgg_view('page/components/map', [
	'markers' => elgg_get_entities_from_metadata([
		'types' => 'object',
		'subtypes' => 'place',
		'metadata_name_value_pairs' => [
			'venue_type' => 'cafe',
		],
		'limit' => 0,
	]),
	'center' => hypeJunction\MapsOpen\Marker::fromLocation('London, UK');
		]);

A map with data source and search

echo elgg_view('page/components/map', [
	// Set src to json data source
	// Data set should be an export of Marker instances
	'src' => '/path/to/data/source/json',
	'show_search' => true,
		]);

Change marker icon and color

Use 'marker','<entity_type>' hook. Supported colors: 'red', 'darkred', 'orange', 'green', 'darkgreen', 'blue', 'purple', 'darkpuple', 'cadetblue'

elgg_register_plugin_hook_handler('marker', 'object', function($hook, $type, $return, $params) {

	$entity = elgg_extract('entity', $params);

	if ($entity instanceof Event) {
		$return->icon = 'calendar';
		$return->color = 'darkpurple'
	}

	return $return;
})

Change popup content

Add a view for maps/tooltip/<entity_type>/<entity_subtype> or maps/tooltip/<entity_type>/default;

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.