I have JSON files containing a list of polygons coordinates with some properties (global, and also for each 'polygon'). I want to draw these polygons and display their properties with a tooltip using Highcharts map. Usually Highcharts needs standard GeoJSON, but here I must keep the JSON files I have because they are used by other programs. Do you have any idea how to deal with the filling of 'series' and 'mapData' from custom JSON ?
That is clear for simple charts how to do a small function to create tables, but for maps I'm a bit lost ...
EDIT: my (simplified) example of JSON:
{
"Version" : "1.0.0",
"Number of Elements" : 3043,
"Elements": [{
"Index" : 0,
"coordinates": [ [1768, 98], [1784, 90], [1789, 81], [1791, 68], [1785, 52], [1774, 41], [1767, 39], [1742, 48], [1736, 53], [1734, 59], [1736, 69], [1748, 90] ],
"Surface" : 995.55,
"Perimeter" : 114.74,
"Center X" : 1137.53,
"Center Y" : 43.79
},{
"Index" : 1,
"coordinates": [ [1709, 119], [1725, 112], [1739, 102], [1744, 91], [1733, 66], [1708, 49], [1698, 51], [1685, 60], [1677, 68], [1674, 81], [1675, 90], [1682, 105], [1697, 116] ],
"Surface" : 1414.90,
"Perimeter" : 136.44,
"Center X" : 1101.35,
"Center Y" : 54.69
},{
"Index" : 2,
"coordinates": [ [1648, 109], [1664, 97], [1667, 90], [1666, 80], [1657, 68], [1617, 52], [1611, 53], [1603, 64], [1613, 79], [1616, 95], [1626, 106] ],
"Surface" : 973.50,
"Perimeter" : 120.49,
"Center X" : 1055.04,
"Center Y" : 52.38
} ...
I would like to draw these polygons, and use a tooltip to display the "Surface" and "Perimeter" properties.
Well, in fact the answer was really simple.
First of all reading the specs here :
http://geojson.org/geojson-spec.html
I finally decided to convert the JSON inside the Highchart function using this module :
https://github.com/caseypt/geojson.js
which convert very easily JSON to GeoJSON.
Problem solved !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.