Skip to content

Local Profiles

Stable
Available in the US and Canada

This widget shows information related to specific neighbourhoods, boroughs, cities, and other geographies. This information includes Location Scores, heatmaps, text descriptions, and so forth, and is divided into three sections: transportation, services, and character.

Screenshot of an example of the Local Profiles v2 widget

Implementation

Overview

A typical implementation of Local Profiles has a separate web page for each neighbourhood. Each of these neighbourhood pages will display Local Profiles for that specific neighbourhood, using code described in the Example section below.

Specifying neighbourhoods

To specify which neighbourhood to display, the simplest way is to specify its geog_id, which is a unique identifier for the neighbourhood, such as g30_abcd1234. When you sign a contract with Local Logic for Local Profiles, we will provide you with the URL of a geography TSV file with all the geog_ids for the neighbourhoods you’ve requested.

Keeping up-to-date

Neighbourhood boundaries change more often than you might think. Because most neighbourhoods do not have legal definitions (unlike municipal and country boundaries), different people often have different opinions about where exactly a neighbourhood begins and ends.

When our clients disagree with our neighbourhood boundaries, we have a conversation about it, which may result in us deciding to modify our boundaries. This might mean adjusting the boundary shapes, adding new neighbourhoods, and/or deleting them.

For example, we might have a neighbourhood called Golden Fields. However, a client might like to differentiate between properties that are in the east part of the neighbourhood from those in the west. As such, we could split the neighbourhood in two: this would result in the addition of two new neighbourhoods: Golden Fields East and Golden Fields West. We may also decide to delete the original Golden Fields neighbourhood, or keep it as is.

If new neighbourhoods are added, you will need to generate new web pages for them. Similarly, if neighbourhoods are deleted, you’ll need to delete those pages, as their Local Profiles will no longer exist. To ensure that you always have pages for the latest neighbourhoods, and to avoid having pages where Local Profiles no longer appear, we recommend that you automatically query the geography TSV file (see Specifying neighbourhoods section above) nightly and refreshing / regenerating your neighbourhood web pages.

Examples

With Google Maps

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<title>Local Logic - Local Profiles Example</title>
<script src="https://maps.googleapis.com/maps/api/js?key={YOUR_GOOGLE_KEY}"></script>
<style type="text/css">
#gmap {
width: 100%;
height: 550px;
}
</style>
</head>
<body>
<!-- Local Logic Widget DOM element -->
<div id="local-profile"></div>
<div id="gmap"></div>
<script type="text/javascript">
var LAT = 45.5017;
var LNG = -73.5656
var gmap = new google.maps.Map(document.getElementById('gmap'), {
center: {
lat: LAT,
lng: LNG
},
zoom: 12,
disableDefaultUI: true,
});
function initLocallogic() {
// Callback that is called when the SDK is ready to be used
var localProfileWidget = new locallogic.LocalProfile('local-profile', {
geogId: 'g10_dpz8e2c5',
googleMapsMap: gmap,
defaultCategory: 'transportation',
defaultShowcase: {
transportation: "pedestrian_friendly",
services: "groceries",
character: "quiet"
},
color: '#1A326B',
color2: '#E4F1FA',
/* default #333 */
color3: 'green',
maxInnerWidth: 1000,
hideProfileTexts: true,
successCallback: function() {
console.log('successCallback');
},
callback: function(err) {
window.alert(err);
}
});
}
</script>
<!-- Load the Local Logic SDK with your Local Logic token -->
<script async defer src="https://cdn.locallogic.co/sdk/?token={YOUR_TOKEN}&callback=initLocallogic">
</script>
</body>
</html>

To test this example live, make sure to replace the {YOUR_TOKEN} placeholder with the token we provided to you and the {YOUR_GOOGLE_KEY} with your Google Maps API key.

With Leaflet Map

<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<title>Local Logic - Local Profiles Example</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<style type="text/css">
#lmap {
width: 100%;
height: 550px;
}
</style>
</head>
<body>
<!-- Local Logic Widget DOM element -->
<div id="local-profile"></div>
<div id="lmap"></div>
<script type="text/javascript">
var LAT = 45.5017;
var LNG = -73.5656;
var lmap = L.map('lmap');
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(lmap);
lmap.setView([LAT, LNG], 14);
function initLocallogic() {
// Callback that is called when the SDK is ready to be used
var localProfileWidget = new locallogic.LocalProfile('local-profile', {
geogId: 'g10_dpz8e2c5',
leafletMap: lmap,
defaultCategory: 'transportation',
defaultShowcase: {
transportation: "pedestrian_friendly",
services: "groceries",
character: "quiet"
},
color: '#1A326B',
color2: '#E4F1FA',
/* default #333 */
color3: 'green',
maxInnerWidth: 1000,
hideProfileTexts: true,
successCallback: function() {
console.log('successCallback');
},
callback: function(err) {
window.alert(err);
}
});
}
</script>
<!-- Load the Local Logic SDK with your Local Logic token -->
<script async defer
src="https://cdn.locallogic.co/sdk/?token={YOUR_TOKEN}&callback=initLocallogic">
</script>
</body>
</html>

To test this example live, make sure to replace the {YOUR_TOKEN} placeholder with the token we provided to you.

With Apple Maps

<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<title>Local Logic - Local Profiles Example</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<style type="text/css">
#lmap {
width: 100%;
height: 550px;
}
</style>
</head>
<body>
<!-- Local Logic Widget DOM element -->
<div id="local-profile"></div>
<div id="lmap"></div>
<script type="text/javascript">
var LAT = 45.5017;
var LNG = -73.5656;
var lmap = L.map('lmap');
lmap.setView([LAT, LNG], 14);
function initLocallogic() {
// Callback that is called when the SDK is ready to be used
var localProfileWidget = new locallogic.LocalProfile('local-profile', {
geogId: 'g10_dpz8e2c5',
leafletMap: lmap,
basemap: 'apple',
appleMapsType: 'default', // valid values are 'default', 'satellite' and 'hybrid'
appleMapsToken: '{YOUR_APPLE_MAPS_TOKEN}',
defaultCategory: 'transportation',
defaultShowcase: {
transportation: "pedestrian_friendly",
services: "groceries",
character: "quiet"
},
color: '#1A326B',
color2: '#E4F1FA',
/* default #333 */
color3: 'green',
maxInnerWidth: 1000,
hideProfileTexts: true,
successCallback: function() {
console.log('successCallback');
},
callback: function(err) {
window.alert(err);
}
});
}
</script>
<!-- Load the Local Logic SDK with your Local Logic token -->
<script async defer
src="https://cdn.locallogic.co/sdk/?token={YOUR_TOKEN}&callback=initLocallogic">
</script>
</body>
</html>

Please note that at this time Apple Maps can only be integrated as a basemap with Leaflet. To test this example live, make sure to replace the {YOUR_TOKEN} placeholder with the token we provided to you and the {YOUR_APPLE_MAPS_TOKEN} with your MapKit JS JSON Web Token.

Options

ParameterStatusDescription
geogIdrequiredTwo alternative methods for specifying the geography (i.e. neighbourhood, borough, city, etc.) whose profile will be displayed.
To obtain a full list of these IDs, reach out to your main contact at Local Logic, or email support@locallogic.co
googleMapsMapoptionalThe Google Maps map instance you want the Local Profiles widget to be associated with.
You must include either this option or leafletMap
leafletMapoptionalThe Leaflet map instance you want the Local Profiles widget to be associated with.
You must include either this option or googleMapsMap
basemapoptionalString value that specifies the basemap of the widget if you are using the leafletMap option.
Available: esri, apple
Default: esri
appleMapsTypeoptionalIf you select the Apple basemap (apple), you can select which style of map you would like to display.
Available: default, satellite, hybrid
Default: default
appleMapsTokenoptionalIf you select the (apple) basemap, you must provide your MapKit JS JSON Web Token
defaultCategoryoptionalSpecifies which Location Scores category should be displayed when the Local Profiles widget loads.
Available: transportation, services, character
Default: transportation
defaultShowcaseoptionalSpecifies, for each Location Scores category tab, which Location Score is displayed when the tab opens.
Available:
transportation: pedestrian_friendly, cycling_friendly, transit_friendly, car_friendly
services: groceries, restaurants, cafes, shopping
character: quiet, vibrant, nightlife, parks
Default: {transportation: "pedestrian_friendly", services: "groceries", character: "quiet"}
coloroptionalHexadecimal color value used for the text and scores.
color2optionalHexadecimal color value used for the icon of the currently selected Location Score.
color3optionalHexadecimal color value used for the category section tabs.
maxInnerWidthoptionalInteger value specifying the width, in pixels, of the inner section of your web page.
When this option is set, the map will fill the width of the widget. This option is ignored on mobile display, and when the width of the widget container is less than the value specified for maxInnerWidth.
Default: 1000
hideProfileTextsoptionalBoolean value to specify whether the text component of the Local Profiles should be hidden or not.
Default: false (text appears)
successCallbackoptionalA JavaScript function to be called when Local Profiles are available for a specific location.
callbackoptionalA JavaScript function to be called when Local Profiles are not available for a specific location.
Edit this page on GitHub
1 contributorjpvalery
Last edited by jpvalery on July 20, 2020