Tag Archives: Physics
World Bank Economic Indicators w/ Farseer Physics Engine
The World Bank recently published a free web API that provides access to up to 50 years of economic, financial and health data. Today the lab published a new web application that maps any one of the 1,000+ economic and financial indicators for any region of the world. The application contains a time slider and animation controls that allow the user to browser this data over time.
As with the demographics web application published last month, this application also uses the Farseer Physics Engine. The physics engine is used to reposition symbols close to their respective country while avoiding overlaps.
The application is running live here.
Source code for the application can be downloaded here.
This application may look simple but a number of issues were encountered during its development. Firstly, the server hosting the World Bank’s web services does not contain a cross-domain access file. To work around this issue we published a proxy service on the same site hosting the Silverlight application. This added unnecessary latency but is unavoidable. This article on the ArcGIS Resource Center describes how to implement a proxy service for remote map services.
Another issue involved the overwhelming number of web requests. If zoomed to the full extent of the map the application will submit 209 web requests if the user clicks an item from the list of 1000+ economic indicators. To solve this, a throttling class was developed to queue urls and only permit five concurrent asynchronous requests at any one time.
Lastly, as powerful as the Farseer Physics Engine is, it tends to fail when the size and shape of objects change rapidly. Occasionally you may observe a small circle getting trapped inside a larger one. To avoid this we added logic to detect trapped symbols and throw them to them out to the edge of the screen.
Contributed by Richie C.
Demographics Web App using Physics Engine
Inspired by the New York Times Medal Map for the 2008 Olympic games, the Applications Prototype Lab undertook an exercise to reproduce this capability with US census demographics data.
The solution was to combine Esri’s ArcGIS API for Silverlight with the Farseer Physics Engine. The Physics Engine allows symbols to be repositioned around the map without obscuring or overlapping other symbols. To prevent symbols from drifting off the map, a spring was attached to each symbol and to their respective state/country/blockgroup.
Use the table of contents on the left hand side of the application to toggle between demographic themes. The slider at the bottom of the table of contents will exaggerate the size of the dots on the map. Detailed information is displayed when the mouse is placed directly over a dot as pictured above. If a state dot is clicked, the map will display county demographic information for that state. Similarly, clicking on a county dot will reveal blockgroup data.
The live application can be accessed here.
The source code can be downloaded from here.
In summary, this Silverlight-based web application uses a open-source physics engine to reposition proportional symbols in a thematic map. The collision detection and mechanics of the physics engine allows us to preserve the symbol size and shape. In some applications this technique may be a good alternative to cartograms.
Contributed by Richie C.

