pessek / pessek_mapsopen
Maps built with open tech
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:elgg-plugin
Requires
- php: >=7.4
- composer/installers: ^1.0.8
- npm-asset/leaflet: ~1.0
- npm-asset/leaflet.awesome-markers: ~2.0
- npm-asset/leaflet.markercluster: ~1.0
Conflicts
- elgg/elgg: <4.0
This package is not auto-updated.
Last update: 2024-09-26 07:45:37 UTC
README
API and UI for maps built with open technology
Screenshots
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
;
Acknowledgements
- Early version of the plugin has been partially sponsored by [Social Business World] (https://socialbusinessworld.org "Social Business World")