How to Guide: Creating Custom Layercake URLs for Sharing or Embedding
Creating your own custom view of Layercake is easy! This can be done to share a specific URL with friends or to embed on blogs, websites, etc.
Available customizations include the following options or parameters:
Enable 1 or more layers
Set the location to be centered on the screen with latitude and longitude
Adjust the zoom level of the map
Remove buttons for a cleaner look when embedding
If you’re interested in other options to control, please contact us via email (link in the footer).
Let’s build an example of a custom view of Layercake to share with a friend:
Start with the address of our web app followed by a forward slash and a question mark:
Next, add on parameters. Let’s start with one layer:
Now, let’s add an additional layer:
Now, let’s set the center point to be San Francisco:
Finally, let’s set a zoom level to see the entire Bay Area:
That’s it, you can now share this link with others to see this exact view!
Let’s build this same example to be embedded into a blog post:
First, let’s start with the URL we ended with from above:
Now, let’s add in the embed control for a cleaner look without the buttons.
Assuming we’re using basic HTML to embed this into a page, let’s place this inside an iframe to house this view and specify the size as 600 x 800 pixels.
And you’re done! This code can be placed into any place where HTML is accepted in order to embed your custom view of Layercake.
One or more layers can be added to the URL to allow only those specific layers to appear
Layer names are the same name as found in the menu, followed by an underscore and city abbreviation. Any spaces in the name are replaced with underscores.
For example, the Songkick layer for San Francisco is named Songkick_SF. The Tiki Bars layer in San Francisco is named Tiki_Bars_SF. A recent listing of available layers in SF is below. For most the most recent layers, please check layerca.ke.
To specify the layer in the URL, use the syntax, &layer=Insert_Name_of_Layer_Here.
To specify multiple layers, repeat the above step.
The centered location of the map when the URL is opened can be set by specifying a latitude and longitude. To set the centered location use the following syntax, &lat=XYZ&lng=XYZ.
The latitude and longitude can be set to any number of decimal places.
If the latitude and longitude is not set, the default location is San Francisco, unless the user has enabled their location to be shared. If the user’s location is shared, then their location will be used instead. Specifying a latitude and longitude will override this.
The zoom level of the map can be adjusted by using the syntax, &zoom=X. The specified level is a float value starting at 1 as the widest view and becoming more narrower or zoomed in as the number increases.
The layer, settings, and map buttons can be removed by adding &embed=1. This will remove all of the additional buttons, leaving only the Layercake logo, for a cleaner look when embedding the view into a small space or controlling how much a user can view.