No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


MyCity helps web developers to build data maps of their city with interactive data-popups for each area.

MyCity is open source and works in modern web browsers, including on tablets and phones so that your community can access your data.

It was developed by James Gardner for Tom Ress (DataPress) and Paul Hodgson (London DataStore) for the MyLondon project. They would love to see you build on the project to make more data available to the public.

Customizing MyCity for your own project involves two stages:

  • Configuring the core engine with your data sources and settings
  • Implementing your own popup to display your data when a user clicks on a particular map area

You don't need to change the core MyCity code to use it, although since it is Open Source, you are free to do so if you wish.

To see an example app built with MyCity, have a look at

Browser Compatibility

Works best in IE9 and above, modern Firefox, Chrome and Safari.


To create your own MyCity-based app, you'll need the following:

  • The pre-built dist/mycity.js and dist/mycity.css files from the repository for the browser application
  • A server running the CKAN DataStore API such as for the popup

Create an index.html file that includes mycity.js and mycity.css as follows:

<!DOCTYPE html>
<html lang="en">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Start MyCity -->
    <script src="mycity.js"></script>
    <link rel="stylesheet" href="mycity.css" />
    <!-- End MyCity -->
    <div id="app"></div>
        handleFeatureClick: function(event, oa, lsoa, subLayer, summary, boundaries) {

If you save this in the dist directory where the mycity.js and mycity.css files already are, you will be able to serve the app from that directory:

python -m SimpleHTTPServer

Now visit http://localhost:8000/.

You'll see a copy of the app running.

Now you can update the handleFeatureClick() function to load data for a popup.{
  handleFeatureClick: function(event, oa, lsoa, subLayer, summary, boundaries) {
    var apiServer = "";

    var resource_ids = {
      "MyLondonSchoolsCatchmentv2"             : "98ec0962-af1a-49ad-ac10-47606f7794da",

        mycity.getFromDataStore(apiServer, 'modelled_OA_rents', 'OA11CD', oa, resource_ids),
    ).then(function(result) {
      // Replace this with your popup visualisation
      alert('Data loaded, see console.');

If a user shares a URL after the popup is clicked, the handler above will be called when the other user loads the URL.

In addition to the handleFeatureClick setting used in there are the following config options, with this as their default values. You can set any of these variables to customise the app:

  attribution: '',
  cards: {
    'travel': {
      text: 'Public Transport',
      icon: 'icon.png',
      background: '#eed645',
    'green': {
      text: 'Number of Green Spaces',
      icon: 'icon.png',
      background: '#96bf31',
    'safety': {
      text: 'Safety',
      icon: 'icon.png',
      background: '#5da7a8',
    'schools': {
      text: 'Schools',
      icon: 'icon.png',
      background: '#db6b66',
  logo: 'logo.png',
  summaryURL: '',
  summaryPrimaryColName: 'OA',
  colors: [
  opacity: 0.4,
  budgetColor: 'rgba(0,0,0,1)',
  budgetOpacity: 0.5,
  modifierWeightings: [
    [66, 34],
    [45, 33, 22],
    [40, 30, 20, 10]
  bboxURL: '',
  bboxPrimaryColName: 'lsoa',
  geoJSONBaseURL: '',
  handleFeatureClick: function(event, oa, lsoa, subLayer, summary, boundaries) {
    alert('No handleFeatureClick() function in the config')
  App: App,
  defaults: {
    lat: "51.50479250125297",
    lng: "-0.07864236831665039",
    zoom: "15",
    budget: "1000",
    theme: "travel,green,safety,schools"
  elemID: 'app',
  tileURL: 'https://stamen-tiles-{s}{z}/{x}/{y}.png',


If you are contributing to MyCity core, you'll need to read this section. If you just want to use MyCity in your own project, please follow the instructions in the Tutorial above.


Install node and npm if you need to and set up the path.

On linux:

tar zxfv node-v0.10.33-linux-x64.tar.gz
export PATH=$PATH:node-v0.10.33-linux-x64/bin/

On Mac:

brew install node

Get the code:

git clone
cd mycity

Build the NPM dependencies and fetch the JS dependencies we need:

npm install

Now fetch the polyfills for IE:

./node_modules/bower/bin/bower install

Note that there is a .bowerrc file in the root directory that specifies where bower should put the scripts. If this is missing you'll need to move bower_components into build/bower_components

Build the project:

npm run lib

For a debug build (with source map) you can use:

npm run lib-debug

This will produce the dist/mycity.js and dist/mycity.css files for you to use in your project.