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 files must match.
- The maximum size of the .shp component of the Shapefile is 200MB per upload. There is no limit on the number of features that the dataset can contain.
- If you do not have a .prj file as part of your Shapefile, you will need to create one.
Creating a .prj
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.
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. It’s fairly basic and may not solve all problems.
- 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 is meter based. It’s advisable to save to a new file so you don’t mess up your 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?
- Column 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 column names?
- Some column names are reserved. Any of these field/column names might cause the upload to fail:
xmin
,xmax
,ymin
,ymax
Are you using invalid characters?
Shapefiles use a dBase file format (.dbf). dBase is a technologically ancient file format devised more than 35 years ago, and as such it doesn’t permit many of the newfangled unicode characters we enjoy in the 21st century.
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.
eg.:
Valid: data_2011
Invalid: 2011_data
, data@home
, "data"
, name#4
, name (final)
, <name>
Invalid characters
If your column 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.