https://github.com/zotonic/zotonic_mod_geomap
OpenStreetMaps and GoogleMaps support module for Zotonic
https://github.com/zotonic/zotonic_mod_geomap
Last synced: 5 months ago
JSON representation
OpenStreetMaps and GoogleMaps support module for Zotonic
- Host: GitHub
- URL: https://github.com/zotonic/zotonic_mod_geomap
- Owner: zotonic
- License: apache-2.0
- Created: 2020-08-24T06:40:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T09:45:13.000Z (about 1 year ago)
- Last Synced: 2025-01-16T05:30:05.108Z (10 months ago)
- Language: JavaScript
- Size: 1.07 MB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mod_geomap
==========
Support for displaying maps and adding geographical locations to
:term:`resources ` in the admin.
Calculates quadtile codes from lat/long location stored in Zotonic
resources, and other geo-related functionality.
Uses OpenStreetMap for display of maps in the admin and on Zotonic
websites.
Configuration
-------------
This modules has the following configuration keys:
* `mod_geomap.provider` Either `openlayers` (default) or `googlemaps`
* `mod_geomap.google_api_key` The API Key for Google Maps requests
* `mod_geomap.location_lat` Default latitude for map views
* `mod_geomap.location_lng` Default longitude for map views
* `mod_geomap.zoomlevel` Default zoomlevel for map views (0..29)
Search query: geo_nearby
------------------------
The module exposes a new search query type called `geo_nearby`, which is used like this:
{% with m.search[{geo_nearby id=1306 distance=10}] as results %}
Required parameters are `id` or (`lat`+`lng`), and `distance` (which
specifies the search radius in kilometers).
The results are ordered, the nearest location is given first. (When
the `id` parameter is given, the first result is thus the id itself).
Optional parameters are `cat`, which can be a list of categories to
which to restrict the resulting resources to.
Service: /api/geomap/nearby
---------------------------
Retrieve a list of resources with (basic) information about them, all
of which are in the vicinity of the given resource or lat/lng pair.
Internally uses the `geo_nearby` search mechanism, and has the same parameters.
It returns a list of JSON objects with for each resource the following
resource properties: id, title, summary, location_lat, location_lng,
location_zoom_level, created, modified, publication_start, image_url.
Service: /api/geomap/locations
------------------------------
The module exposes an API service at `/api/geomap/locations`, which
returns a list of locations for the search or id given.
Custom tag: geomap_static
-------------------------
Shows a location’s map using static images from OpenStreetMap.
{% geomap_static latitude=52.34322 longitude=4.33423 %}
The location is taken from the tag’s `latitude` + `longitude`
parameters, or, when absent, from the `id` parameter which is supposed
to be a Zotonic resource of category `location` (e.g. having an
address).
It displays the `_geomap_static.tpl` template.
Other parameters:
`zoom`
Zoom level (defaults to 14)
`n`
How many rows and cols to display (defaults for the `rows` and `cols` parameters), defaults to 2.
`cols`
How many grid columns to display
`rows`
How many grid rows to display
`size`
The size in pixels of each tile, defaults to 256.