Posts

Showing posts from October, 2017

Updating Features in Openlayers 4.x

Image
Let's say you have this following set-up:

var jsonObj = {
        "type": "FeatureCollection",
        "features": [
            {
                "geometry": {
                    "type": "Point",
                    "coordinates": [124.112122, 8.112132]
                },
                "type": "Feature",
                "properties": {
                    "device_id": 138,
                    "data":"old_data"
                }
            }, 
            ...
}

var vectorSource = new ol.source.Vector({
        features: (new ol.format.GeoJSON()).readFeatures(jsonObj)
 });
var vectorLayer = new ol.layer.Vector({
        source: vectorSource,
        style: pointStyleFunction
});
 ...//other code like adding the layer to the map
setProperties  Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any exi…

Deploying Django Apps in Heroku

Image
Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. If you have a simple Django app that doesn't require huge storage or database, Heroku is the best choice. Their free service will suffice your need. Your app will be available almost 24/7 (~23 days up time in a month). You are given 550 hours per month and if you have a credit card, an additional of 450 hours will be rewarded. Enough to make your app to be available always. The server also sleeps  after 30 mins of inactivity. This enables you to save uptime hours.

In deploying Django in Heroku you just need to have this ff. files:
.gitignoreruntime.txtrequirements.txtProcfileDjango App  All file must reside in the project directory as shown below:
.gitignoreis a text file containing the type of files within the directories that wont be included in the deployment of app

runtime.txtis a text file containing the version of Python that the app will use. Example…