Map Files

Same Data, Different Structures

Data Files:

Data that can be inputed into our map builder platform can be structured in many different types of files. These files all generally serve the same purpose which is to store data in a structured format for access by machines. A list of all the files accepted by World Map along with file structure documentation are provided below.

GIS Files:

Additionally, our platform allows input of custom topoJSON files which can be created from both shapefiles and geoJSON files.

Code Array
Text/CSV Files

A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format. A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line will have the same number of fields.

Supported Files

Code Example

country,value,fillKey

USA,3,defaultFill

CAN,4,defaultFill

MEX,5,defaultFill

Spreadsheets

A spreadsheet is a computer application for organization, analysis and storage of data in tabular form. The program operates on data entered in cells of a table. Each cell may contain either numeric or text data.

A spreadsheet consists of a table of cells arranged into rows and columns and referred to by the X and Y locations. X locations, the columns, are normally represented by letters, "A", "B", "C", etc., while rows are normally represented by numbers, 1, 2, 3, etc. A single cell can be referred to by addressing its row and column, "C10" for instance.

References:

[1] Apache Open Office

[2] Microsoft Excel

Supported Files

Popular spreadsheet programs that we provide inputs for include Microsoft Excel and Apache Open Office.

Warning: Only the first sheet of your spreadsheet will be used for data entry so conversion to .csv is sometimes preferred.

Javascript Objects

The Object class represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities. A Javascript object can be created from a JSON or PHP array as well as by itself. This format is the most native to entering data into the platform.

The values are written as name:value pairs (name and value separated by a colon).

References:

[1] W3 Schools: Javascript Objects

[2] Mozilla Developer: Javascript Objects

Code Example

<script>

var jsObject = {

USA: {fillKey: "defaultFill", value: 3},

CAN: {fillKey: "defaultFill", value: 4},

MEX: {fillKey: "defaultFill", value: 5}

};

</script>

JSON Arrays

Arrays in JSON are almost the same as arrays in JavaScript. In JSON, array values must be of type string, number, object, array, boolean or null. In JavaScript, array values can be all of the above, plus any other valid JavaScript expression, including functions, dates, and undefined.

JSON Formatter

+ Read More

+ JSON.stringify()

JSON.stringify()

The JSON.stringify() method converts a JavaScript object or value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.

+ JSON.parse()

JSON.parse()

The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.

References:

[1] W3 Schools: JSON Data Types

[2] W3 Schools: JSON Objects

[3] W3 Schools: JSON Arrays

[4] W3 Schools: JSON Parse

[5] W3 Schools: JSON Stringify

Code Example

{

"USA":{"name":"United States","value":3,"fillKey":"defaultFill"},

"CAN":{"name":"Canada","value":4,"fillKey":"defaultFill"},

"MEX":{"name":"Mexico","value":5,"fillKey":"defaultFill"}

}

XML Files

XML is a markup language which is designed to case sensitive store data in a file (.xml). It's popularly used for the transfer of data and is very similar to a JSON array. XML offers you more options over JSON to define markup elements and generate customized markup language. XML is much more readable to a non-technical person than JSON arrays.

JSON XML
It is a way of representing objects. It is a markup language and uses tag structure to represent data items.
It supports array. It doesn’t supports array.
Its files are very easy to read as compared to XML. Its documents are comparatively difficult to read and interpret.
It is less secured. It is more secured than JSON.
It doesn’t supports comments. It supports comments.

References:

[1] W3 Schools - XML Intro

[2] W3 Schools: JSON vs XML

JSON Example

A JSON array with country subdivisions.

{"USA":[

{ "state":"NY", "value":"3", "fillKey":"defaultFill" },

{ "state":"PA", "value":"4", "fillKey":"defaultFill" },

{ "state":"OH", "value":"5", "fillKey":"defaultFill" },

{ "state":"MI", "value":"6", "fillKey":"defaultFill" }

]}

JSON to XML Conversion

<USA>

<subdiv><state>NY</state><value>3</value><fillKey>defaultFill</fillKey></subdiv>

<subdiv><state>PA</state><value>4</value><fillKey>defaultFill</fillKey></subdiv>

<subdiv><state>OH</state><value>5</value><fillKey>defaultFill</fillKey></subdiv>

<subdiv><state>MI</state><value>6</value><fillKey>defaultFill</fillKey></subdiv>

</USA>

PHP Arrays

An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible.

References:

[1] PHP Manual: Arrays

Code Example

<?php

array(

USA => array("value" => 3,"fillKey" => "defaultFill"),

CAN => array("value" => 4,"fillKey" => "defaultFill"),

MEX => array("value" => 5,"fillKey" => "defaultFill")

);

?>

topoJSON

TopoJSON is an extension of GeoJSON that encodes topology. Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs. Arcs are sequences of points, while line strings and polygons are defined as sequences of arcs.

Each arc is defined only once, but can be referenced several times by different shapes, thus reducing redundancy and decreasing the file size. In addition, TopoJSON facilitates applications that use topology, such as topology-preserving shape simplification, automatic map coloring, and cartograms.

You can convert either geoJSON or shapefiles to topoJSON using Mapshaper. You can also use this free tool to validate and test custom topoJSON files before implementation in our platform.

References:

[1] Mapshaper

{

"type": "Topology",

"objects": {

"cuw": {

"type": "GeometryCollection",

"geometries": [

{

"type": "Polygon",

"properties": {

"name": "Curaçao"

},

"id": "CUW",

"arcs": [[[9050,1613],[822,-1016],[127,-262],[-206,-172],[-491,-118],[-576,-45],[-465,52],[-610,352],[-1209,1001],[-1188,431],[-764,541],[-687,674],[-297,616],[-161,581],[-379,188],[-447,50],[-363,166],[-308,446],[-712,1404],[-271,237],[-318,202],[-264,256],[-111,388],[54,1024],[-42,544],[-184,486],[130,255],[114,105],[115,-26],[130,-139],[992,-511],[420,-313],[419,-442],[257,-537],[242,-1327],[213,-573],[850,-982],[989,-579],[2917,-866],[335,-249],[138,-363],[69,-579],[181,-352],[539,-548]]],

"transform": {

"scale": [0.00004320500410041281, 0.000035021405740579754],

"translate": [-69.17174231699991, 12.041327216000042]

}

}

geoJSON

GeoJSON is an open standard format designed for representing simple geographical features, along with their non-spatial attributes. It is based on the JSON format.

GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. Geometric objects with additional properties are Feature objects. Sets of features are contained by FeatureCollection objects.

References:

[1] geoJSON.org

[2] geoJSON Map Editor

[3] Wikipedia: geoJSON

Code Example

{

"type": "Feature",

"geometry": {

"type": "Point",

"coordinates": [125.6, 10.1]

},

"properties": {

"name": "Dinagat Islands"

}

}

Shapefiles

A shapefile is a vector data storage format for keeping the location, shape, and attributes of geographic features. It is developed and regulated by Esri as a mostly open specification for data interoperability among Esri and other GIS software products. The shapefile format can spatially describe vector features such as points, lines, and polygons representing features. Each item usually has attributes that describe it, such as name or temperature.

Shapefiles must be converted to topoJSON files for usage.

References:

[1] Wikipedia: Shapefiles

Geometry Schema
Geometry Schema