Plugin: Sales region polygon (with PostGIS)

From iDempiere en


What does it do

For each sales region, you can create a record in a new IP_Geometry table. Each record describes a sales region as a polygon. A polygon is an area on a map that is defined by a set of coordinates (longitude and latitude). Using the import and export tools, you can update the polygon. With the help of various services, for example https://geojson.io/ or https://yandex.ru/map-constructor/, you can create or edit a polygon or multipolygon.

With this plugin you can solve the problem “Does the buyer's address get into the delivery area?” (see MGeometry.isContains(lat, long)).

Polygon 1.png
Polygon 2.png

Instructions for use

  1. Open any Geo JSON editor like https://geojson.io/ or https://yandex.ru/map-constructor/ and click New.
  2. Using the Polygon tool draw the desired area.
  3. Click Save and select GeoJSON, save the file.
  4. Open the Sales Region window and select the desired region.
  5. On the tab, select the Import Geo JSON process, specify the file, and click OK.
  6. Refresh the window and now a polygon has been created for this region.
  7. To edit the polygon, select the Export Geo JSON process and indicate on what date you want to receive the data.
  8. The MGeometry class has a method IsContains(lat, long) which will return True if the coordinate is in the polygon.

Additionally

If the sales region is IsSummary, then a child sales region will be created when the polygon is imported. If you want to have a multipolygon, then create a sales region as IsSummary and use the Import \ Export processes on it. If you want to get a specific version of a polygon, then open an entry in the Geometry tab and select the Export Geo JSON process.

How to Install

  1. Install the PostGIS Database Extension (https://postgis.net). Make sure that the following query works for you: SELECT public.postgis_Version();
  2. Install the plugin using Felix
  3. Done!
Cookies help us deliver our services. By using our services, you agree to our use of cookies.