This recipe is going to be about finding and parsing data that describes regions that we might want to plot on a map. Such regions might be countries, states, provinces, and so on. The Natural Earth website at http://www.naturalearthdata.com/, offers geographical data about multiple subject, one of them are political geographical regions. We are going to use that data on our OpenScales map.
Having read the previous recipes about using OpenScales will greatly help. Also open the files downloaded from the Packt Publishing website to follow along.
The following are the steps required to parse data to use as region fill:
Head over to https://www.google.com/fusiontables/DataSource?dsrcid=424517.
Copy the column called
json_4326
; this is the data that we are going to use as source.Create a class called
PolygonParser.as
that will get a JSONString
value and return aPolygon Vector
value.Transform the JSON
String
value into an ActionScript...