Showing posts with label wikipedia. Show all posts
Showing posts with label wikipedia. Show all posts

Thursday, May 7, 2015

Atlasify Beta Released, Learn About Explicit Spatialization

Explicit spatialization "'spatializes' or 'projects' any object into a pre-defined reference system such as a periodic table, map, or seating chart.  It is being used for exploratory search of the web, specifically Wikipedia, and similar sources of information.   Enter Atlasify, a collaboration between the University of Minnesota and Northwestern University.  The web address is www.atlasify.com or http://spatialization.cs.umn.edu/.

How does Atlasify do this?  Well, it uses semantic relatedness--basically a scoring system to be able to pair and match things that are related.  Visualization options include: mapping/geography, chemistry/a periodic table, politics/senate seating chart, and history/a timeline.

If you are having trouble thinking about this, thats okay!  Let's go through a couple of examples. Be sure to click each map to make it larger.

First an easy one: the geography of nuclear weapons.  Note the key in the bottom right-hand corner. Some countries are obviously more closely related to nuclear weapons (those that have, thought to possess, or are pursuing that technology). 

Some countries are more related to the search term nuclear weapons than others.
Lets look at another example, which is still spatial, but uses senates seat locations.  See the example below which looks at the relatedness between medical marijuana and senate seats.  Some senators are more closely tied to the issue, whether pursing legislation for or against.  Some of those senators even sit near each other or across the aisle.
Some senators are more related to the issues of medical marijuana than others.
Lastly, let's look at an example using the periodic table and searching for "rechargeable battery" to see which elements are most related. Elements like Lithium, Nickel, and Cadmium are most related.


Lastly, Atlasify has a little fun gaming component which asks which of two items are more related to certain countries: http://spatialization.cs.umn.edu/game/index.html

Interested learning more about spatial computing? Be sure to check out my review of the Coursera course from the University of Minnesota:http://opensourcegisblog.blogspot.com/2014/12/review-of-spatial-computing-class-on.html.

Thursday, December 11, 2014

R GeoNames API

R has a package (geonames) for connecting to the GeoNames API.  If you are not familiar with GeoNames be sure to check out this previous post with a few examples.  The documentation for the package can be found at: http://cran.r-project.org/web/packages/geonames/geonames.pdf

Step #1: Getting a Free Account
You will need to visit  http://www.geonames.org/login to create a free account.  Note: GeoNames has free and premium services.

Step #2: Activating the Account
After receiving a confirmation e-mail, log-in, and click the activate link.  Look midway or towards the bottom of the page.  It is easy to miss!  If you do not activate the account, you will receive an error message in R such as '401 Unauthorized'.

Step #3: Installing and Loading the Package in R
The simplest way to a install a package in R is to go the toolbar at the top, select "Install Packages", choose a download source or simply select "OK" and then scroll down until you find "geonames" in all lowercase letters.

  • After the package installs, you will also have to Load Package from the same toolbar.  
  • Loading the package from the toolbar will have to be done each session--unless you write a short bit of code to do the same automatically.
  • Also make sure you have admin privileges on the computer you are working on.


Step #4: Connecting to the API
In R, you will have two write two lines setting "options" to access the API.  Simply replace "your username" in red with your username!  You will also have to set the host--which is currently api.geonames.org.  Please note in some older documentation and websites this is listed incorrectly as an older address.  It is also possible, although not likely, it could change in the future but would be listed here.

options(geonamesUsername="your username")
options(geonamesHost="api.geonames.org")

Step #5: Test Your Connection
In R, simply type:

source(system.file("tests","testing.R",package="geonames"),echo=TRUE)

If everything is setup correctly, R will pause for a few seconds and return geographic data like in the screenshot below.

Running the code above, you can test your connection.

Step #6: GeoNames Structure
Remember geographic data can have different hierarchies (See Place Hierarchy Webservices) and be accessed in different ways. Be sure to read through the GeoNames and R package documentation to be certain you are getting your desired result.  There are a number of user-defined functions in the GeoNames package.

Examples of user-defined functions:

  • GNcities () - returns cities within a bounding box
  • GNearthqukes () - returns recent earthquakes
  • ...and many more!

Step #7: Getting Geographic Information from Wikipedia, Saving...
For example, one function in the package allows you search Wikipedia articles and retrieve geographic information (i.e. lat, long, elevation).  For example the following code looks for up to 10 articles with "oriole" and stores them in a R dataframe named results:

results<-GNwikipediaSearch("oriole", maxRows = 10)

Click the screenshot to open in a larger window
Example of results, with rank and geographic information, lat, long, and elevation.
You can also type "summarize(results)"--without the quotes -- remember 'results' is the name of the data set to view all of the variables.  The data can also be exported from R.  Keep in mind you can use R to perform exact or fuzzy merging with a data set of place names you have.

Monday, November 17, 2014

GeoNames: 8 Million-plus Placenames for Free

GeoNames is an open-source geographical database, which you can download, that contains information on many types of features, in various languages, has attribute data (such as elevation) and comes with lat/long coordinates.

You can see a breakdown of the number of features by country at: www.geonames.org/statistics/.  In addition to being able to download the data in bulk, GeoNames also has collaboration and editing features similar to other open mapping ecosystems.

Example: Populated Places Around Mt. Everest
Before downloading,  open the Readme: http://download.geonames.org/export/dump/readme.txt to make sure you are grabbing the correct files.  It will also describe the column names and send you to a few other webpages for reference information.  For example, you will also want to read through the feature codes at: http://www.geonames.org/export/codes.html

Populated places (PPL) from GeoNames.  Click to enlarge.
Other data sources: USGS (DEM) and Natural Earth (Roads, Rivers,etc.).
There are also free and premium web services: http://www.geonames.org/commercial-webservices.html

Editing
GeoNames also allows users to add and edit data.  A screenshot of the interface for Mt. Everest:

Add/Edit Interface
You can also view a history of edits:
Wikipedia Map
Lastly, you can even view Wikipedia entries on an interactive map:

Markers pop-up for entries in Wikipedia
GeoNames data sources: http://www.geonames.org/data-sources.html