Plugin: Georeferencing Map

From iDempiere en
Jump to navigation Jump to search
BXSGeoForm.png


Description

  • This plugin extends iDempiere with a new way to visualize data in a map.
  • The georeferencing plugin displays data as markers in a map.
  • You can configure the data to be configured flexibly with SQL.
  • You can click on a marker to see additional information.
  • You can set different colors for different markers.
  • Set the latitude/longitude fields for every address in a tenant with a process.
  • This plugin uses the same longitude/latitude fields created by Nicolas Micoud in this plugin.

The plugin adds a window, a Form and a Process.

To be able to use this plugin you need to set the System Configurator MAPBOX_API_KEY. You can get a Mapbox access token here.

Configuration

This window allows the user to configure the data to be displayed on the map.

Field Description
Name Set the name of the map record, this name will be shown in the map form select list, it can be translated.
Description The description is shown in the right panel as a title.
Comment/Help The Text written here is shown in the right panel as text, it can be used to explain to the user the color notation of the map.
Zoom Level Defines the initial Zoom Level when the map is first opened, it must be a value between 0 and 22.
Latitude Initial Latitude defines where the center of the map will be when it first opens.
Longitude Initial Longitude defines where the center of the map will be when it first opens.
Table Sets the main source of data for the map.
SQL From The Select Clause indicates the SQL FROM clause to use for selecting the record for a measure calculation. It can have JOIN clauses. Do not include the FROM itself.
SQL Where The Where Clause indicates the SQL WHERE clause to use for record selection.
Other SQL Clause Any other complete clause like GROUP BY, HAVING, ORDER BY, etc. after WHERE clause.
Show Organization Marker Defines if the logged organization location is shown as a reference marker or not. (It only works if the organization selected at login is not *)
Organization Marker Color Color used for the organization marker
Longitude Clause Defines which part of the SELECT is to be used as the Longitude point.
Latitude Clause Defines which part of the SELECT is to be used as the Latitude point.
Title Clause Defines which part of the SELECT is to be used as the marker's title.
Description Clause Defines which part of the SELECT is to be used as the marker's description.
Color Clause Defines the rules to be set the marker's color.
Active The record is active in the system.


BXSGeoConfig.png

Usage

The Georeferencing form allows you to interact with the pre-configured maps. A list of the available maps is shown (if pre-configured).

When you select one of the maps from the list, the corresponding map is displayed and when you click on a marker the marker configuration is shown in a box.

Note: The description and Comment/Help are shown in the right panel as a tooltip box. This can help to define the color notation

HelpBox.png Example of a map showing the customers with more invoices in the year 2018

Set Address Longitude/Latitude Process

This process sets the longitude/latitude of the location records of the logged client. The organization parameter can be set to set the longitude of a specific organization as well.

As the process runs calling an API for each location (Batch call only works on MapBox EE), the process by default calls every 50 location and then wait for 1 second for the answer to avoid database locks. You can change this by setting the System Configurator: MAPBOX_BATCHSIZE and MAPBOX_WAITING_SECONDS.

Note: Depending on the internet connection, the process can be expensive to run, if you notice that please set a lower BATCHSIZE and a higher waiting time.

Technical Aspects

The repository is split into two plugins: de.bxservice.georeferencing and de.bxservice.georeferencing_mapbox.

The first one (de.bxservice.georeferencing) is created as a general plugin, defining everything needed to create and render maps with HTML. The configuration window, process, and form are all there to be reused. The second plugin is then developed as a service used by this one and can be interchangeable.

Thus, de.bxservice.georeferencing_mapbox is a specific integration that uses Mapbox as the API provider, but other plugins can be developed as well following this principle to display the pre-configured maps using different technologies (GMaps, Graphhopper, etc.), for example this plugin.

I'm developed a provider for gmap at th.motive.georeferencing.gmap
at moment that provider work with fork of de.bxservice.georeferencing