Coder Social home page Coder Social logo

sv-geolocation's Introduction

Geolocation

The module sv-geolocation is an iTop extension to add a new attribute type called AttributeGeolocation to provide geographic coordinates. This new attribute type is added to the Location class as a new field. The module also provides a new dashboard dashlet GeoMap which adds an interactive map.

Installation

Place this in the extensions folder of your iTop instance and run iTop setup again. Be sure to enable the extension during setup.

Configuration

After installation, it is possible to change some settings in order to let this module fully function.

provider

Specify the provider you want to use for maps. Currently, only Google Maps is supported for interactive maps.

  • GoogleMaps
  • OpenStreetMaps
  • MapQuest

api_key

Depending on the provider you are using, you might need to enter the API key.

To use maps from Google Maps, you will need to acquire an API key.

staticmapurl

This value depends on which map provider (GM, OSM, ...) you want to use for thumbnails. It only needs to be set if you want to override the default behaviour.

Depending on each map provider, there are several paremeters to give. The following parameters will be filled in:

  1. Latitude from the object.
  2. Longitude from the object.
  3. Width from datamodel.
  4. Height from datamodel.
  5. API key from configuration.
  6. Zoom from configuration.

Example values for staticmapurl:

  • Google Maps: https://maps.googleapis.com/maps/api/staticmap?markers=%f,%f&size=%dx%d&key=%s.
  • Open Street Map: http://staticmap.openstreetmap.de/staticmap.php?center=%1$f,%2$f&markers=%1$f,%2$f,red-pushpin&size=%3$dx%4$d&zoom=%6$d
  • MapQuest: https://www.mapquestapi.com/staticmap/v5/map?locations=%f,%f&size=%d,%d&key=%s&zoom=%d

Note that you can also use QR Code Generator as thumbnail generator. The resulting value for staticmapurl then looks like: https://api.qrserver.com/v1/create-qr-code/?data=geo:%f,%f&size=%dx%d&bgcolor=eee

default_latitude

This is the default latitude when a new dashlet is displayed.

default_longitude

This is the default longitude when a new dashlet is displayed.

default_zoom

This is the default zoom for dashlet maps and for static maps. Note that by default, the static map from Google Maps have a dynamic zoom level. If you want a fixed zoom level, you will need to reflect this in the parameter staticmapurl.

display_coordinates

This value specifies if the coordinates of the geolocation also should be shown under the thumbnail. This is enabled by default. Note that when you don't have thumbnails, the coordinates will always be displayed.

XML Data Model Reference

Field type is AttributeGeolocation.

Definition

  • sql (mandatory) The column used to store the value into the MySQL database.
  • default_value (mandatory) The default value (can be specified as an empty string).
  • is_null_allowed (mandatory) Set to "true" to let users leave this value undefined, "false" otherwise.
  • width (optional) Width of the static image, in pixels. Defaults to 200.
  • height (optional) Height of the static image, in pixels. Defaults to 150.

Example

<field id="geo" xsi:type="AttributeGeolocation">
    <sql>geo</sql>
    <default_value/>
    <is_null_allowed>true</is_null_allowed>
    <width>200</width>
    <height>150</height>
</field>

XML Dashboard Reference

Dashlet type is GeoMap.

Definition

  • rank (mandatory) Display rank.
  • height (optional) Height of the interactive map. Defaults to 600.
  • search (optional) Whether or not to activate address search. Defaults to "false".
  • query (mandatory) The OQL query to select the objects to be placed on the map.
  • attribute (mandatory) The geolocation attribute to use for placing the object on the map.

Example

<dashlet id="1" xsi:type="GeoMap">
    <rank>1</rank>
    <height>500</height>
    <search>true</search>
    <query>SELECT Location</query>
    <attribute>geo</attribute>
</dashlet>

Notifications

This module also adds some functions to choose the coordinate system when the attribute is used in notifications.

Representations

  • $this->geo$ or $this->wgs_84(geo)$: Display the coordinates in EPSG:4326 (lat,lon).
  • $this->rd(geo)$ or $this->rijksdriehoek(geo)$: Display the coordinates in EPSG:28992 (X,Y).
  • $this->html(geo)$: HTML representation just like in the detail or list view.

Preview

Location detail view

Location detail

Location list view

Location list

Dashboard Dashlet

GeoMap Dashlet

Contribute

Translation

Translations can be submitted via Transifex. Please create a new issue if you want a new language to be added to the project.

sv-geolocation's People

Contributors

hipska avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sv-geolocation's Issues

geolocation not found

Hi,
I've installed your plugin (itop 2.7.x). It's installed and the "geolocation" appears in the dashboard but I cannot edit, add, modify or even see the field "geolocation" in the Location page.
Any idea how to solve this.
I figure it may be a problem with other plugins (jb-tweak for config-mgmt and or Molkobain).
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.