Note: for an updated version of this and other articles, we recommend you to check our knowledge base here
GUIDE: Import Geofences from KML/KMZ
How to install
Make sure all plugins are green under SiteAdmin -> Plugins.
The privilege controlling access to the feature is called _ImportGeofence, found under Geofences in SiteAdmin App Privileges. By default it is enabled for the Administrator role.
1. Login to your Vehicle Tracker application.
2. Open the "Geofences" tab.
3. In the drop-down menu left hand side, just below the "new circle" and "new polygon" commands you should now find the "import geofence" option.
Selecting it the following dialog shows up:
From the top:
Choose KML file
Here you chose a file. You can choose any file as long as it is KML/KMZ format.
At the moment only polygons
Polygons with holes are not supported. In that case only the outer boundary
will be imported and the inner boundary, holes
Self intersecting polygons are also not supported and will be skipped (same rules as when you create polygons in the editor).
Here you can create a new geofence tag right away, or, if you click the "Existing tag" button, choose an existing tag to add the imported fences to.
If you select a file the field defaults to the filename, or you can simply leave it blank.
Create a tag based on document name
True/false selector (default True). When enabled creates a tag with same name as the KML document, which is then added to all geofences in the document.
Create a tag for each (named) polygon
True/false selector (default True).
This is most useful if your KML uses s.c multi geometry
I.e. in KML you can define geometry placemarks which contains several geometrical representations.
Example: "My neighbourhood" which contains polygons resembling many individual buildings. Using this flag all of those buildings will be grouped under the "My neighbourhood" tag.
(Each geofence polygon will be named "My neighbourhood (1)", "My neighbourhood (2)" etc though).
The key to understanding and using GpsGate geofences is the tag feature.
Once you have selected a file and are pleased with your settings click the "Upload" button.
When the upload is finished you will get either an "OK" or a "Warning" message containing number of polygons imported or names of the polygons that were rejected for example.
Known issues and limitations
- If you get a "File size too large" error it is because you hit a limit in your IIS setting, typically 4 Mb.
You can increase the limit by editing your web.config file. See for example http://stackoverflow.com/questions/288612/how-to-increase-the-max-upload-file-size-in-asp-net
- But first you might consider compressing your KML to KMZ format!
- If you have a very large KML file (many polygons) or a slow server you might experience a timeout, typically 120s or so.
-The geofence name limit is 128 characters.
-The limit for "custom ID" is 64 characters. If you don't specify an ID in your KML file, the ID will be set to the same as the geofence name, i.e. if the name is 128 characters long the import will not work since the custom ID will be too big.
You can either:
-add an ID to each geofence in your KML file: `<Placemark id="CUSTOM_ID">`. And the custom ID must be unique. It is used to know which geofence to update/replace instead of creating copies every time you import the same file.
-Or, you are limited to 64 characters in the current implementation.