Skip to main content

Import geozones from a CSV file

Drawing twenty checkpoints by hand takes an afternoon. If you already have their corner points — from a survey, a spreadsheet or another system — you can create them all at once from a CSV file: a plain text file in which each line is one point and the values are separated by commas. Every spreadsheet can save one ("Comma Separated Values").

Before you start​

  • Your role must allow you to import geozones (Supervisor, Operational manager and System admin can). If it does not, the Import CSV button is not on the Geozones screen.
  • Have the corner points ready as decimal degrees, for example 8.5875 and 39.1455 — not degrees and minutes.
  • Only many-sided zones can be imported. Circles cannot: draw those one at a time in the editor.

What the file must look like​

The first line names the columns, and every line after it is one point:

name,lat,lng
Modjo dry port,8.5875,39.1455
Modjo dry port,8.5875,39.1585
Modjo dry port,8.5770,39.1585
Modjo dry port,8.5770,39.1455
Galafi border crossing,11.7215,41.8290
Galafi border crossing,11.7215,41.8420
Galafi border crossing,11.7105,41.8420
Galafi border crossing,11.7105,41.8290
ColumnOther accepted namesWhat it holds
namezone_nameThe name of the zone this point belongs to.
latlatitudeLatitude in decimal degrees, between -90 and 90.
lnglon, longitudeLongitude in decimal degrees, between -180 and 180.

Rules IFMS follows when it reads the file:

  • The first line must name the columns. They can be in any order, and capitals do not matter. Other columns are ignored.
  • Lines with exactly the same name make one zone, in the order they appear. The example above creates two zones of four corners each.
  • Each zone needs at least three points. The shape is closed for you, so you do not repeat the first point at the end.
  • Names must be new. A zone whose name is already used by a zone in use is refused — capitals and spaces at either end do not count, so Modjo Dry Port clashes with Modjo dry port.
  • Empty lines are ignored, and spaces at the start and end of a value are removed.
  • A name that contains a comma must be inside double quotes, for example "Modjo dry port, gate 2",8.5875,39.1455.
  • Up to 20,000 point lines and 5 MB in one file.

Imported zones arrive active and many-sided, with no address, no note, no group, no speed limit and no colour of their own (so once you put them in a group, they are drawn in its colour). Open one in the editor afterwards to fill those in.

Import the file​

  1. Open Configuration → Geofencing, then select Import CSV. The window Import geozones from CSV opens, with the line "Each row is one lat/lng point. Rows sharing a zone name form a polygon (minimum 3 points)."

  2. Select Download template if you want an example file as a starting point. It is saved as geozone-template.csv and you can open it in any spreadsheet.

  3. Put your points into the window. Either select Choose CSV file and pick your file — its contents replace anything in the box, and the file name is not shown — or paste the lines straight into CSV contents. You can edit them there.

  4. Read the Preview underneath. It appears as soon as the box has any text and it changes as you type.

    The Import geozones from CSV window with example rows typed in and a preview showing two valid zones

  5. When the preview shows the zones you expect, select Import N zones.

Select Cancel at any time to close without importing. Closing the window empties the box.

What happens after you select Import​

IFMS checks every zone again before it creates it, and shows its answer in a Server result panel at the bottom of the window: "S of T imported", followed by one line per refused zone, Row N: and the reason.

  • Everything imported: the message 2 geozones imported (or however many) confirms it, the window closes and the new zones appear in the list.
  • Some refused: the amber message "S imported, F failed" appears and the window stays open, so you can read which rows were refused. The zones that were accepted are already created.
  • Nothing imported: the red message No geozones were imported. appears and the window stays open.

The Server result panel showing 0 of 1 imported and the row the server refused because the name is already in use

After an import, the Import button stays greyed out until you change the contents of the box, so the same rows cannot be sent twice by accident. Correct or remove the refused rows, then import again.

Row numbers are the line numbers in your file: the column line is line 1, and blank lines count too.

What the preview tells you​

PartWhat it means
Preview, with 1 valid zone / N valid zones on the rightHow many zones your lines would create.
The list of names, each with N ptsThe first five zones and how many corners each has. More than five shows +N more.
No valid zones found yet.Nothing in the box can become a zone. The button stays Import and cannot be used.
The amber box 1 issue / N issuesLines IFMS cannot use. The first five problems are listed; more shows +N more.

Lines with a problem are skipped, and the rest are still imported: the button counts only the zones that are good. Fix the file if you need every zone.

The preview does not know which names are already in use: a name clash only shows in the Server result.

The same window with a mistyped latitude, a short line and a zone with too few points, and the amber box listing the three issues

Message in the previewWhat is wrong
The file is empty.The box has nothing but blank lines.
The first row must be a header naming the columns: "name,lat,lng".The first line does not name the columns. Nothing is read until it does.
Row N: expected 3 columns, got C.That line does not have the values the column line promises.
Row N: missing zone name.The name on that line is empty.
Row N: invalid latitude "value".The latitude is not a number between -90 and 90 — often a letter typed for a digit, or a comma used as the decimal mark.
Row N: invalid longitude "value".The longitude is not a number between -180 and 180.
Zone "name": needs at least 3 points to form a polygon (has C).That name appears on fewer than three usable lines. Add the missing corners, or check for a spelling difference in the name.
Message in the Server resultWhat is wrong
Row N: name is blankThe name on that line is empty.
Row N: longitude/latitude not numericA coordinate on that line is not a number.
Row N: zone 'name': polygons need at least 3 distinct pointsThe zone has fewer than three different corners.
Row N: zone 'name': a geozone named 'name' already existsA zone in use already has that name. Rename the zone in your file, or rename or delete the existing zone.
Row N: zone 'name': … with another reasonThe shape cannot be accepted — for example its edges cross. Check the order of the corners.

If something goes wrong​

What you seeWhat to do
Import is greyed outThe preview found no valid zone — correct the issues listed underneath — or you have just imported these rows: change the box to import again.
The uploaded file exceeds the maximum number of rows.The file has more than 20,000 point lines. Split it.
The uploaded file is too large.The file is bigger than 5 MB. Split it.
The uploaded file could not be read.Save it again as CSV from your spreadsheet and try again.