Title: Geocoding - JSFiddle - Code Playground
Description: JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
Keywords:
Domain: jsfiddle.net
{
"@context": "http://schema.org/",
"@type": "Code",
"name": "Geocoding",
"description": "Geocoding",
"url": "jsfiddle.net//breinify/egyhn5fz/",
"dateCreated": "",
"author": {
"@type": "Person",
"name": "Breinify",
"homeLocation": "San Francisco",
"worksFor": "Breinify Inc."
},
"codeSampleType": [
{
"@type": "SoftwareSourceCode",
"programmingLanguage": "javascript",
"text": "// set the configuration for Breinify and leafLet
Breinify.setConfig({ 'apiKey': '938D-3120-64DD-413F-BB55-6573-90CE-473A' });
initLeafLetMap();
var samples = [ 'NYC', 'San Francisco', 'Dallas', 'Miami', 'Bemidji' ];
for (var i = 0; i < samples.length; i++) {
var t = samples[i];
var q = {additional: {location: {text: t}}};
window.map.setView([39.8282, -98.5795], 3);
Breinify.temporalData(q, false, function(data) {
var latLon = [data.location.lat, data.location.lon];
var popup = L.popup();
popup.setLatLng(latLon);
popup.setContent('<b>' + data.location.city + '</b>');
window.map.addLayer(popup);
});
}
function initLeafLetMap() {
// simplify access
window.map = L.map('map');
var url = 'https://api.mapbox.com';
url += '/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token=';
url += 'pk.eyJ1IjoiYnJlaW5pZnkiLCJhIjoiY2owd3ZjdHJwMDAydzMyc2Q3MWI0MXZkdCJ9';
url += '.sf4BzE0VIlIQ-vp-mpatbw';
var c = 'Map data © ';
c += ' <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ';
c += ' <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ';
c += 'Imagery © <a href="http://mapbox.com">Mapbox</a>';
L.tileLayer(url, { attribution: c, maxZoom: 15 }).addTo(window.map);
}
/*
* The following is not part of the example and just used to measure how many
* people actually look at this example.
*/
var sId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);
});
if (Breinify.UTL.cookie.check('breinify_jsFiddle')) {
sId = Breinify.UTL.cookie.get('breinify_jsFiddle');
} else {
Breinify.UTL.cookie.set('breinify_jsFiddle', sId, 100 * 365);
}
Breinify.activity({ 'sessionId': sId }, 'jsFiddle', { 'fiddle': 'qq4ryw6y' });"
},
{
"@type": "SoftwareSourceCode",
"programmingLanguage": "html",
"text": "<div id="map"></div>"
},
{
"@type": "SoftwareSourceCode",
"programmingLanguage": "css",
"text": "#map { height: 500px; }
.leaflet-popup-close-button { display: none; }"
}
]
}
| author | JSFiddle |
| copyright | share alike |
| ipc | US |
| googlebot | index, follow |
| apple-mobile-web-app-capable | yes |
| apple-touch-fullscreen | yes |
| theme-color | #1E1F1F |
Links:
Viewport: width=device-width, initial-scale=1, maximum-scale=1
Robots: index, follow