Skip to main content

Embedding on websites

You can put the Nearby map on any web page with an iframe, and choose what to show: a place, your events, some categories, a city.

Privacy

The embedded map doesn't set cookies and doesn't profile traffic. The temporary data from its use, kept on the servers as a cache, is usually deleted after 24/48 hours, as stated in the Terms and Conditions.

The basic code​

There are no requirements: copy and paste this code into the page.

<iframe
src="https://embed.nearbycommunity.it/"
allow="geolocation"
width="100%"
height="600"
style="border:0"
></iframe>
  • allow="geolocation" is only needed if you want the map to ask the visitor for their location (see geolocate).
  • In width and height you can use px, pt or percentages. It's best to put the iframe in a div, with width and height at 100%, and set the size on the div.
  • Don't put sandbox on the iframe. If you really need it, add allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox, otherwise Learn more won't open the new tab.

How to write the parameters​

There are two equivalent ways:

  • in the path (recommended), separated by /: https://embed.nearbycommunity.it/theme:dark/zoom:15/controls:true
  • in the query string: https://embed.nearbycommunity.it/?theme=dark&zoom=15&controls=true

Lists are separated by commas: show:id1,id2.

The parameters​

ParameterValuesDefaultWhat it does
themelight, dark, autoautothe map theme; auto follows the device theme, even if it changes while the map is open
localefor example it_it, en_us, fr_fr (also it, en)the browser language, otherwise it_itthe language of the texts
centerlng,lat (for example 9.1189,39.2238)the visitor's location or a default viewthe point the map opens on
zooma number (for example 15)18the initial zoom
centerpointtrue, falsefalseshows a dot on the visitor's location (if they've already shared it), otherwise on center
geolocateuseremptywith user the map asks the visitor for their location; if empty, it never asks
targetpoi, events, categorynonewhat to show: only places, only events or categories
showlist of ids (or of category slugs with target:category)noneshows only these items or categories
hidelist of ids (or of category slugs)nonehides these items or categories
userusername (the @ is optional)noneshows only that user's items
cardopen, closeclosewith open, if show contains only one item, its card opens straight away
controlstrue, falsefalseshows the compass, 2D / 3D and zoom at the top left
blocktrue, falsefalselocks the map: no panning, zooming, tilting or rotating, no controls; clicking on items still opens their card
Coordinates

Coordinates are written as longitude,latitude, with a dot for decimals: the comma only separates the two numbers. Correct: 9.1189,39.2238. Wrong: 9,1189,39,2238.

Old parameters

map_center (like center) and map_zoom (like zoom) also still work.

Good to know​

  • Automatic framing: with target:poi or target:events plus show, and without center, the map frames the listed items by itself.
  • Card open straight away: with only one item in show and card:open, the card opens when the map loads.
  • Scroll lock: at first the map is locked, so the page hosting it scrolls normally; the visitor clicks on the map to activate it, and the button at the top left locks it again. With block:true this step doesn't happen.
  • Card: clicking an item opens its card on the right, with a button to expand or close it.
  • Copyright: Nearby's copyright is at the bottom left; Learn more opens the Nearby website in a new tab.

Examples​

The map of Cagliari, with the dark theme and the controls:

<iframe src="https://embed.nearbycommunity.it/center:9.1189,39.2238/zoom:15/theme:dark/controls:true" allow="geolocation" width="100%" height="600" style="border:0"></iframe>

A single place, with the card already open and the map locked:

<iframe src="https://embed.nearbycommunity.it/target:poi/show:PLACE_ID/card:open/block:true" width="100%" height="600" style="border:0"></iframe>

Only events, in English:

<iframe src="https://embed.nearbycommunity.it/target:events/locale:en_us/center:9.1189,39.2238/zoom:14" width="100%" height="600" style="border:0"></iframe>

Only some categories:

<iframe src="https://embed.nearbycommunity.it/target:category/show:bakery,concert/center:9.1189,39.2238/zoom:15" width="100%" height="600" style="border:0"></iframe>

Only a user's items, with the location request and the dot:

<iframe src="https://embed.nearbycommunity.it/user:mario/geolocate:user/centerpoint:true" allow="geolocation" width="100%" height="600" style="border:0"></iframe>
Where do I find the ids?

The id of an event or a place is in its link: for example in nrb.to/p/PLACE_ID or in app.nearbycommunity.it/view/poi/PLACE_ID.