Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

HamHamFonFon/kurtography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kurtography

Build Status

Welcome !! Kurtography is a cartography application based on Openlayers 3 and Kuzzle for Kaliop Koding Challenge

Table of contents

Plugin Status

Beta stage of development : v. 0.14.0

Requirements

Installation

// Clone the repository
git clone git@github.com:HamHamFonFon/kurtography.git kurtography
cd kurtography

// Installation of dependencies
npm install

Configuration and Getting started

Create roles for users

node dist/test/roles/createRoleAuth.js
node dist/test/roles/createRoleUser.js

Create profiles linked to roles

node dist/test/profiles/createProfileUser.js

Note: You can add the role "auth" to the profil "admin", so the admin could be login with his kuzzle credentials

If you want to create a testing user, run:

In progress...

Connexion to kuzzle

Edit file dist\services\kuzzle-config.js and change values of kuzzleUrl and defaultIndex

export default {
    kuzzleUrl: 'url_to_kuzzle_instance', // ex : localhost (without "https://" and without port)
    defaultIndex: 'name_of_your_kuzzle_index'
}

Geodatas projection

Edit file dist\services\geo-parameters.js and change value projectionTo. You can specify default coordinates for people who block navigator geolocation

export default {
    projectionFrom: 'EPSG:3857',
    projectionTo: 'EPSG:4326'
    latDefault: 48.856614,
    longDefault: 2.352222,
    icons: {
        'collection_name': 'images/path_to_icon.png'
    }
}

Note: Don't change "projectionFrom" and "projectionTo" values. "projectionFrom" is the projection using by Openlayers. Kuzzle, who use Elastic Search, recorded geografic datas only in 'EPSG:4326' who is the WGS-84 projection (using in GPS, Google Map...)

Note 2: Default coordinates are from Paris, France

Note 3: If you want to attach an icon or an image to a feature (only with type Point), set in "icons" the key/value pair 'collection_name':'images/path_to_icon'

Create compiled files

Files bundle.js and bundle.css must be created with this following commands, by default, they're not exists.

Compile and minify CSS files :

npm run build-css

A minify CSS will be create in "public/css/"

Run the app with the following command which compile modifications using browserify and babelify :

npm run build-map

A script bundle.js will be compiled in "public/js/", and after run with

npm start

Kuzzle Back-Office

Collections mapping

In Kuzzle-BO, when create a new collection, the mapping must be like (see dist/fixtures/mapping-collection.json) :

{
  "properties": {
    "datas": {
      "properties": {
        "location": {
          "type": "geo_shape",
          "tree": "quadtree",
          "precision": "1m"
        },
        "centroid": {
          "type": "geo_point",
          "lat_lon": true
        },
        "userId": {
          "type": "string"
        },
        "nbNotifications": {
          "type": "integer"
        }
      }
    },
    "fields": {
      "properties": {
        "name": {
          "type": "string"
        },
        "date_publish": {
          "type": "date",
          "format": "YYYY-MM-dd"
        },
        "description": {
          "type": "string"
        },
        "url_image": {
          "type": "string"
        }
      }
    }
  }
}

Datas :

Item type Information
Location GeoShape field store location, see Geo Shape
Centroid Geo point Store the centroid of the object (for the subscribe() kuzzle method)
UserId string Id of user, creator of feature
Number notifications Integer Set the number of views of the item

Fields:

Item type Information
Name String Name of your object
Date publish Date Date of publish (format YYYY-MM-dd)
Description string Description of object
Url image String Kuzzle don't store image, but can store an url

Data format


Read Kuzzle documentation for more information about KuzzleCollection and KuzzleDocument

Exemple of KuzzleDocument working in Kurtography :

{
  "datas": {
    "location": {
        "type": "Point",
        "coordinates": [3.9609146118164054, 43.624395670027354]
    },
    "centroid": {
        "lon": 43.624395670027354,
        "lat": 3.9609146118164054
    }
    "userId": "HamHamFonFon",
    "nbNotifications": 0
  },
  "fields": {
    "name": "Test",
    "description": "Test ajout",
    "date_publish": "2016-08-29",
    "url_image": ""
  }
}

After create, the field "id" is added to datas. It's the Kuzzle Document Identifier. Datas from kuzzle are converting into geojson for making an openlayers feature.

How to : user documentation

The selection of the layer and the subscribe room is set on the left sidebar : click to left-top button : alt tag

Select layer


List of collections in kuzzle are represented as geographical layers. Select one and documents will be visible. alt tag

Subscribtion room


There are two ways to create a subscribe room :

  • Based on geolocation : a zone with a default radius of 5 km is created. The radius could be changed on the left sidebar. 4 differents scales are predefined : district, city, region and country. You can adjust the radius with the scale line under the option scales

alt tag

  • Manually : the user can specifiate his own subscribe room with the button "Redraw subscribe zone" in the bottom. alt tag After click, the user can draw a circle alt tag

Connexion / authentification


To create, edit or delete kuzzle documents, an account in kuzzle is required. I've create a testing account : kuzzleteam / kuzzle Click on the needed link.

Add/edit/delete datas


When the user is connected, a new panel with many buttons appears on left-side : it's the drawing-control panel.

Icon Description
alt tag Start a tracking feature in real-time based on geolocation (experimental)
alt tag Add a point on the map
alt tag Draw a line
alt tag Draw a square
alt tag Draw a polygon
alt tag Exit drawing mode
alt tag Edit a selected feature
alt tag Delete a selected feature
alt tag Exit edit/delete mode

Features

  • Loading collections as layers
  • Show features from the selected layers
  • Select a projection in EPSG format
  • Create, edit and delete features with an openlayers3 draw control plugin
  • Create and edit properties
  • Create a reference point (for polygons an lines, the reference point is the centroid) for the subscribe room
  • Edit subscribe zone by changing radius
  • Subscribe room : zone from geolocation with 5km radius
  • Search items in subscribe area
  • Get default location if user blocking naviogator geolocation
  • Graphic refactoring with Material Design Lite
  • Reset map to geolocation position
  • Change subscribe zone by geolocalisation
  • Change subscribe zone and search by manual tool
  • Share on social network
  • zoom to document by URL : http://my_site/?layer=kuzzle_collection&name=kuzzle_doc_name&id=kuzzle_doc_id
  • Register user
  • Authentification
  • Filtering features by user for edit and delete

Features in progress

  • Export datas (need ogr2ogr)
  • Tracking position in real time

Features will be avalaible soon:

  • User can subscribe to a specific item

Author(s)

Stéphane MÉAUDRE - HamHamFonFon stephane.meaudre@gmail.com smeaudre@kaliop.com

Licence

MIT Licence - 2016

See also

My OpenLayers drawing control plugins : https://github.com/HamHamFonFon/ol3-drawButtons

README.md edited by StackEdit

About

A cartography application supported by Kuzzle

Resources

License

Stars

Watchers

Forks

Packages

No packages published