Geographic Data - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Information : Updates : Maple 2017 : updates/Maple2017/GeographicData

Geographic Data

  Maple 2017 updates the DataSets package to include a built-in geographic information database and a map visualization facility.

 

GeoNames Dataset

WorldMap

GeoNames Dataset

The GeoNames data set is a built-in geographic information database which contains data for over one million geographic locations around the world. The GeoNames data set shares the same set of accessing commands as other built-in data sets.

 

Obtain a Reference object for the GeoNames data set:

withDataSets:

withDataSets:-Builtin:

refReferenceGeoNames

refGeonames (GeoNamesid)NameType(7 more)68Boneh-ye Mehdisection of populated place121Lab Sefidlocality166Gorizilocality(1087362 more)

(1.1)

 

Each data entry (row) consists of 10 columns where each column denotes certain information about that geographic location. The first column, GeoNamesid, is an integer id unique to each row.

View a list of all the column headers (not including GeoNamesid):

GetHeadersref

Name,Type,Latitude,Longitude,Country,Province/State/Region,City/County,Population,Time Zone

(1.2)

 

You can search the data set by indexing into the Reference object. The most interesting and useful indexing method is to index by boolean constraints on column values. For example, find all places in Canada with the name Waterloo and see the actual data:

GetDatarefCountry=Canada,Name=Waterloo

Waterloopopulated place45.3500799999999984−72.5158200000000051CanadaQuebecMonteregie4064America/TorontoWaterloopopulated place43.4667999999999992−80.5163900000000012CanadaOntarioundefined97475America/TorontoWaterloothird-order administrative division45.3367300000000029−72.5279599999999931CanadaQuebecMonteregieundefinedAmerica/Toronto

(1.3)

 

Find out which states in the US have population greater than 5 million:

refCountry=United States,Type=first-order administrative division,Population>5000000

Geonames (GeoNamesid)NameType(7 more)4155751Floridafirst-order administrative division4197000Georgiafirst-order administrative division4361885Marylandfirst-order administrative division(18 more)

(1.4)

WorldMap

The WorldMap object under the Builtin subpackage of the DataSets package is new to Maple 2017. It is a versatile map-displaying tool that can cooperate with the GeoNames data set as well as work alone.

 

The WorldMap object can provide visualization for search results from the GeoNames data set. For example, to generate a map of regions of Austria, first search for the data using the GeoNames data set and then create a WorldMap object using the search results:

regionsOfAustriarefCountry=Austria, Type=first-order administrative division;

regionsOfAustriaGeonames (GeoNamesid)NameType(7 more)2761367Wienfirst-order administrative division2762300Vorarlbergfirst-order administrative division2763586Tirolfirst-order administrative division(6 more)

(2.1)

regionsOfAustriaMapWorldMapregionsOfAustria

regionsOfAustriaMapPLOT...A map of the world with 9 pointsprojection: MillerCylindrical

(2.2)

Then, plot the map by calling the Display command on the WorldMap object:

 

The WorldMap object can display great circle paths, which are the shortest paths along the earth's surface between two geographic locations.

For example, connect all capital cities in the world with population greater than 8 million in a loop:

bigPopulationCapitalsReferenceGeonamesType=capital of a political entity,Population>8000000

bigPopulationCapitalsGeonames (GeoNamesid)NameType(7 more)524901Moscowcapital of a political entity1185241Dhakacapital of a political entity1642911Jakartacapital of a political entity(6 more)

(2.3)

bigPopulationCapitalsMapWorldMapbigPopulationCapitals:

seqAddPathbigPopulationCapitalsMap,bigPopulationCapitalsi,bigPopulationCapitalsmodpi,CountRowsbigPopulationCapitals+1,endpoint=false,i=1..CountRowsbigPopulationCapitals:

SetCenterbigPopulationCapitalsMap,0,0:

ZoomOutbigPopulationCapitalsMap:

 

The WorldMap object can display maps under numerous map projections. Some projections are suitable for the type of data visualization presented in previous examples while others make maps themselves interesting and charming to look at. For the complete list of supported map projections, see the List of Projections help page.

 

mWorldMap

mPLOT...A map of the worldprojection: MillerCylindrical

(2.4)

 

For example, to generate a world map in the Van der Grinten projection, call the Display command on m with the projection=VanderGrinten option:

Displaym,projection=VanderGrinten,size=600,600

 

For parameterized map projections, using Display together with the Explore command, you can easily see how the map transforms with respect to changes in the parameters.

For example, the Bottomley projection accepts a standard parallel (φ1) parameter which makes it vary between the sinusoidal projection (φ1=0) and the Werner projection (φ1=90).

Use Explore to see this transformation:

ExploreDisplaym,projection=Bottomleyφ1,grid=true, thickness=0,φ1=0..90,animate=true,size=600,600

The WorldMap object can also highlight the countries of the world based on a set of data using the ChoroplethMap command. The example below shows the countries colored based on their coastline length.

coastlines ReferenceCountry .. , Coastline

coastlinesCountry (Name)CoastlineAfghanistan0Albania362.kmAlgeria998.km(182 more)

(2.5)

 

Many countries have coastline length 0, so taking the logarithm would yield minus infinity. Instead, we add 1 to each coastline length before taking the logarithm.

 

Another example for choropleth maps can be found here: Visualizing Custom Data on a Choropleth Map