Book-Mapper
When we are reading books about Diskworld (by T.D.J. Pratchett) or Middle-earth (by J.R.R. Tolkien) we can operate not only a text. Do you remember about exciting maps inside? Map is a rightful part of such books. We can trace all the adventures on a map to deeper dive in these stories. It is great! But what about novels related to a real world ("Good old Earth")? What is your school mark on geography? Can you (immediately) imagine position of any point in James Bond world trips (by I. Fleming) or Phileas Fogg (by J.G. Verne)? This project will help you to create automatically the map according to a text of your favorite book. (Download project with "Book-Mapper")
Tools and Materials
Tools:
- "Sharp Develop" (or similar Net programming environment) - https://sourceforge.net/projects/sharpdevelop/fil...
- "Google Maps" (web geoinformation system) - https://www.google.com/maps
- PC with MS Windows 7,10 (operating system with Net Framework 4)
Materials:
- "GeoNames" (geographical database in tabulated text format) - https://download.geonames.org/export/dump/
- Your favorite book (in text format)
Note!
If you plan to use this project result you need to have only last two items from Tools and last item from Materials respectively ... and executable module certainly (archive with executable file and all resources for running).
If you want to assemble the project you own use only programming environment (first item of Tools list) - all resources you have in this archive.
Main Idea
The main idea of this project (Fig. 1) is to get all the geographical names from the text, then get coordinates to a special kml-file and finally draw the map according to these points.
Let's see a detailed scheme (Fig. 2).
First (1) we need to load the book in txt-format. Then - prepare the database (2) with data fields: object name, latitude, longitude. We plan to use "GeoNames" resource.
Then our tool need to execute first request to get the list with all the words started from the capital letters (3) (except some unusefull items: "He", "the", "Why", ...). Next task is to find combinations among the "capital"-words (4). According to this scheme the list of words need to be reduced from step to step. So, on the next stage (5) there is a difficult semantic analysis - to divide geo-object (GO) and a living beings (LB) (according by frequency of using (LB >> GO) and associated verbs ("go", "think", "run" for LB)). After that we can remove duplicated Geo-names from the current list (6). At the next stage (7) our tool gets geographical coordinates from the database files according to a current list of names. After that the list can be also reduced. At this moment we need to be able correct the list of Geo-names manually. We plan to draw map on a Google-Maps, so the last thing that "Book-Mapper" do is KML-file generating (8). This xml-text-file can be loaded into Google-Maps directly to get a map (9).
Data Preparation
For our project we need to have geographical database which can be downloaded from "GeoNames" resource (https://download.geonames.org/export/dump/). Then for each base it need to prepare three separate files for "names", "latitude" and "longitude" (with the same index positions). These files will be used by "Boor-Mapper". You can download examples by this link.
Software Project Creating
You can download executable module here... But if you want to assemble this project yourself… here is the source project folder for "Sharp Develop". You can download executable module here... But if you want to assemble this project yourself… here is the source project folder for "SharpDevelop".
From the be beginning:
1) Start "SharpDevelop" > "File" > "New" > "Solution"
2) Select "Windows Application", set the project "name"
3) Put all the necessary controls into the "MainForm" ("Design" mode) ...
4) Write program code (switch to "Source" mode) ...
To create a program code for appropriate button (i.e.) use double click on it on "MainForm" (in "Design" mode).
To run (execute) your project use "Debug" > "Run" command (in "Source" mode).
To get compiled project go to "YOUR PROJECT FOLDER LOCATION" > "bin" > "Debug". Executable module of your project will be located there (don't forget to create folders "out" and "source_data" at this location; "out" - for results, "source_data" - for geo-databases (see previous STEP)).
In any cases all the codes available by the link.
1) Download this project
2) Open *.sln file in "SharpDevelop"
3) "View" > "Projects" > "MainForm.cs"
4) "Debug" > "Run"
Tool Usage: Book-Mapper Stage
Perhaps you have got "Book-Mapper" at last (by assembling a C# project or by downloading ready executable module. Now you are ready to create map according to your favorite book.
First of all create kml-file for txt-document (with book content) using "Book-Mapper" (Book__Map.exe) by the following sequence:
Run "Book-Mapper" >
> "Choose the Geo-Base" (World | GB | USA) >
> Click on "Choose the Book" and select the book in txt-format >
> "Put (or Check) the Title" >
> Click on "Search for Geo-Objects" (wait a bit ...) >
> Select useless items in a result-list and click on "Remove Selected Items" >
> Click on "Generate Map File" >
> Click on "View Map File and ReadMe" (to get kml-file for your book)
Tool Usage: Google-Maps Stage
KML-file is ready and the next stage is Google-Maps job - to get visible state of our map.
Follow the sequence:
1. Open Google-Maps (https://www.google.com/maps) using your account
2. Create a new user Map in Google-Maps:
Google-Maps > "Menu" > "Your places" > "MAPS" > "CREATE MAP" > "Import"
3. Select kml-file and upload it to Google-Maps
4. Google-Maps gives you ability to print or share your own map (related to your favorite book, i.e.).
You can see result map (constructed with "Book-Mapper") for "Adventures of Huckleberry Finn" (by M. Twain) by this link.
Results
Here is some examples of "Book-Mapper" working (see images):
1) "Three men in a boat (To say nothing of the dog)" (by J.K. Jerome)
2) "The Inimitable Jeeves" (by P.G. Wodehouse)
Try project using links(for execute, for C# project assembling).
p.s.
This project is only a model of real software to my opinion. It has a lot of disadvantages (naive semantic analysis, local database, manual connection to Google-Maps (without API), lame program code, ...) but I have a plan to improve it.