Configuring the Map

Configuring the Map

The Map Data

The initial location of the map is determined by two values: 1) the default location in the native app's config file (config.js), and 2) the starting location included in the Map Portlet's JSON REST feed. The native value serves as an initial starting place while the portlet feed is loaded, and can give the map a default location if the feed is offline. 

The map data is currently located at /MapPortlet/api/locations.json, and the data is coming from a simple static JSON file location in /MapPortlet/src/main/resources/mapData.json. 

In the longer term, the expectation is that many schools might want this data to come from somewhere else, whether that's a remote JSON/XML file, a database, or some other mechanism.

Configuring the Map Data

1. Add your default location in the config file (uMobile/Resources/js/config.js)

/* Replace the latitude and longitude with your default location */ this.DEFAULT_MAP_REGION = { latitude: 41.3137919, longitude: -72.9234645, latitudeDelta: 0.005, longitudeDelta: 0.005 };

2. Create a static mapData.json file to reflect your map data. See the sample mapData.json file below:

{ "defaultLocation": { "latitude": "41.3137919", "longitude": "-72.9234645" }, "buildings": [ { "abbreviation": "ARG", "address": "North Frontage Road", "alternateName": "", "latitude": "41.3068877", "longitude": "-72.9424517", "name": "Air Rights Garage", "searchText": "arg~air rights garage~north frontage road~", "zip": "06511", "img": "http://business.yale.edu/map/thumbnail/ARG.jpg" }, { "abbreviation": "ALW", "address": "31 Hillhouse Avenue", "alternateName": "", "latitude": "41.3137919", "longitude": "-72.9234645", "name": "Allwin Hall", "searchText": "alw~allwin hall~31 hillhouse avenue~", "zip": "06511", "img": "http://business.yale.edu/map/thumbnail/ALW.jpg" }, { "abbreviation": "AMISB", "address": "10 Amistad Street", "alternateName": "Amistad Street Building", "latitude": "41.3005410", "longitude": "-72.9298077", "name": "10 Amistad Street", "searchText": "amisb~10 amistad street~10 amistad street~amistad street building", "zip": "06511", "img": "http://business.yale.edu/map/thumbnail/AMISB.jpg" }, { "abbreviation": "AMISG", "address": "10 Amistad Street", "alternateName": "", "latitude": "41.3005410", "longitude": "-72.9298077", "name": "Amistad Street Garage", "searchText": "amisg~amistad street garage~10 amistad street~", "zip": "06511", "img": "http://business.yale.edu/map/thumbnail/AMISG.jpg" } ] }

3. Place your newly created mapData.json file in the /MapPortlet/src/main/resources/ directory path

  • Recommended: Use the maven overlay method 

    • In your uMobile Application server, go to umobile-trunk/uportal-portlets-overlay/MapPortlet. Create the directory structure above (src/main/resources) and place your mapData.json in the resources directory

    • Build and Deploy your uMobile App server with your changes. Execute the line below from your uMobile Application Server the main source folder (e.g., /umobile-trunk)
        ant clean deploy-ear

    • Restart your Tomcat instance


 Our community can help answer your questions


Create a jira issue for the developers


We welcome our community to assist with our documentation and development efforts.