Mango supports shapefiles. Here's what you need to know.
Rather than being a single file, a Shapefile is made up of a collection of files. To upload your data in Shapefile format you will need the .shp, .dbf, .shx, and .prj files.
- The names of all four files must match.
- Point data with more than 4 million records are unlikely to process successfully.
- The combined file size of all four components should not exceed 200 MB.
- If you do not have a .prj file as part of your Shapefile, you will need to create one.
How to create a .prj file
If you are using a desktop GIS, you can define your coordinate system as follows:
- ArcGIS™
Use the “Define Projection” tool
- QGIS
Go to Vector → Data Management Tools → Define Current Projection
Alternatively, you can download a .prj file from Spatial Reference or epsg.io. This site allows you to find and download specific coordinate systems e.g. “WGS 1984 UTM Zone 33N”.
From the list of results returned in the search, select the appropriate one and the click then click the link “.PRJ File” to download the file.
After you download the .prj file, you will need to rename it to be the same as your shapefile:
parcels_2015.shp
parcels_2015.dbf
parcels_2015.shx
parcels_2015.prj
Many shapefiles that don’t have a .prj file are using WGS84/Lat Long (EPSG:4326), so if you are unsure what coordinate system your data is using then you should try using this coordinate system first.
Copy the following to a text file, and save as .prj
to match your shapefile name as above.
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
See the full attributes here.
Shapefile Upload Errors
There are a number of reasons why a shapefile upload might fail. Here are the most common reasons.
Terminology tip: a "field" in GIS is akin to a "column" in a spreadsheet. A "field name" = column header or column name.
Is your shapefile empty?
Mango only supports shapefiles that contain features. To see if the Shapefile you are using contains features, open the Shapefile on a desktop GIS to check.
Does your data have corrupt or null geometry?
Open the shapefile in a desktop GIS and clean or repair your shapes before re-uploading.
- ArcGIS™
Run the “Repair Geometry” tool, which can be found in Data Management Tools → Features → Repair Geometry.
A basic standalone tool for repairing shapefiles can be downloaded here. Note that it's fairly basic, and may not solve all geometry issues.
- QGIS
Run the tool Vector → Geometry Tools → Check Geometry Validity. If errors are reported, these might be causing problems.
A quick fix for geometry errors is found in Vector → Geometry Tools → Simplify Geometry. Use a simplify tolerance of 0.1 if you data's unit of measure is the metre.
It’s advisable to save simplified datasets to a new file so you don’t lose your original data.
A more advanced solution is to use a plugin called lwgeom. There are a few steps involved to install and cleanup your file, so it’s best to follow the instructions in the video below if you are attempting this for the first time.
If you are still having problems with corrupt polygon geometry, consider converting polygons to lines and then back to polygons.
Does your Shapefile have “M” coordinates?
- Mango does not support M Coordinates. You will need to remove M coordinates and convert the data to a regular shapefile.
Do you have blank data?
- Field names MUST contain a value. Check in a desktop GIS if all layers are named.
- Date fields CANNOT be empty. We recommend using an arbitrary date such as 01/01/1900.
Do you have invalid field names?
- Some field names are reserved.
The following field names may cause an upload or reupload to fail:xmin
,xmax
,ymin
,ymax
Are you using invalid characters in the field names?
Shapefiles use a dBase file format (.dbf). dBase is a technologically ancient file format devised nearly four decades ago, and as such it doesn’t permit many of the newfangled unicode characters we enjoy here in the 21st century. While this is one reason why Shapefile are considered very robust and reliable, it can mean upload errors in Mango when using languages other than English.
Valid characters
a b c d e f g h i j k l m n o p q r s t u v w y x z 0 1 2 3 4 5 6 7 8 9 _
- Column names can only contain letters a to z, numbers, and the underscore.
- Column names must begin with a letter.
For example:
A valid field name: data_2011
Invalid field names: 2011_data
, data@home
, "data"
, name#4
, name (final)
, <name>
Invalid characters
If your field names use any of these characters, you’re going to have a bad time.
` ~ @ # $ % ^ & * ( ) - + = | < > / \ , . ! ? ' " [ ] { } : ;
The length of a field name (header) cannot be more than 10 characters.
Encoding issues
Mango supports UTF-8 encoding. If your attribute data isn’t encoded UTF-8, it may fail to upload.
Many languages are, by default, encoded in a variety of different character sets, and these need to be decoded to display correctly. UTF-8 is a character set designed to encompass all languages in one character set.
If your data attributes contain characters with graves, accents, and other ligatures, or is in a language other than plain English, it’s likely that text is encoded in a character set other than UTF-8. To successfully upload to Mango, you will need to convert the encoding to UTF-8.
When converting to UTF-8, it is possible that some characters won’t make it through intact, so be sure to check your attributes thoroughly after any conversion.
Characters in the column names other than those in the VALID list above will be stripped out and replaced with an underscore.
In QGIS, select UTF 8 from the Save dialog.