Blog RSS Feed

Archive for the ‘Geo’ Category

Using Machine Learning to Enhance the Resolution of Bible Maps

Friday, March 1st, 2019

In a previous post, I discussed how 3D software could improve the resolution of Bible maps by fractally enhancing a digital elevation model and then synthetically creating landcover. In this post I’ll look at how machine learning can increase the resolution of freely available satellite images to generate realistic-looking historical maps.

Acquiring satellite imagery

The European Sentinel-2 satellites take daily photos of much of the earth at a ten-meter optical resolution (i.e., one pixel represents a ten-meter square on the ground). The U.S. operates a similar system, Landsat 8, with a fifteen-meter resolution. Commercial vendors offer much higher-resolution imagery, similar to what you find in Google Maps, at a prohibitive cost (thousands of dollars). By contrast, both Sentinel-2 and Landsat are government-operated and have freely available imagery. Here’s a comparison of the two, zoomed in to level 16 (1.3 meters per pixel), or well above their actual resolution:

Sentinel-2 shows more washed-out colors at a higher resolution than Landsat 8.

The Sentinel-2 imagery looks sharper thanks to its higher resolution, though the processing to correct the color overexposes the light areas, in my opinion. Because I want to start with the sharpest imagery, for this post I’ll use Sentinel-2.

I use Sentinel Playground to find a scene that doesn’t have a lot of clouds and then download the L2A, or atmosphere- and color-corrected, imagery. If I were producing a large-scale map that involved stitching together multiple photos, I’d use something like Sen2Agri to create a mosaic of many images, or a “basemap” (as in Google Maps). (Doing so is complicated and beyond the scope of this post.)

I choose a fourteen-kilometer-wide scene from January 2018 showing a mix of developed and undeveloped land near the northwest corner of the Dead Sea at a resolution of ten meters per pixel. I lower the gamma to 0.5 so that the colors approximately match the colors in Google Maps to allow for easier comparisons.

The Sentinel-2 scene.

Increasing resolution

Enhance!” is a staple of crime dramas, where a technician magically increases the resolution of a photo to provide crucial evidence needed by the plot. Super-resolution doesn’t work as well in reality as it does in fiction, but machine learning algorithms have increased in their sophistication in the past two years, and I thought it would be worth seeing how they performed on satellite photos. Here’s a detail of the above image, as enlarged by four different algorithms, plus Google Maps as the “ground truth.”

Comparison of four different super-resolution algorithms plus Google Maps, as discussed in the following paragraphs.

Each algorithm increases the original resolution by four times, providing a theoretical resolution of 2.5 meters per pixel.

The first, “raw pixels,” is the simplest; each pixel in the original image now occupies sixteen pixels (4×4). It was instantaneous to produce.

The second, “Photoshop Preserve Details 2.0,” uses the machine-learning algorithm built into recent versions of Photoshop. This algorithm took a few seconds to run. Generated image (1 MB).

The third, ESRGAN as implemented in Runway, reflects a state-of-the-art super-resolution algorithm for photos, though it’s not optimized for satellite imagery. This algorithm took about a minute to run on a “cloud GPU.” Generated image (1 MB).

The fourth, Gigapixel, uses a proprietary algorithm to sharpen photos; it also isn’t optimized for satellite imagery. This algorithm took about an hour to run on a CPU. Generated image (6 MB).

The fifth, Google Maps, reflects actual high-resolution (my guess is around 3.7 meters per pixel) photography.

Discussion

To my eye, the Gigapixel enlargement looks sharpest; it plausibly adds detail, though I don’t think anyone would mistake it for an actual 2.5-meter resolution satellite photo.

The stock ESRGAN enlargement doesn’t look quite as good to me; however, in my opinion, ESRGAN offers a lot of potential if tweaked. The algorithm already shows promise in upscaling video-game textures–a use the algorithm’s creators didn’t envision–and I think that taking the existing model developed by the researchers and training it further on satellite photos could produce higher-quality images.

I didn’t test the one purpose-built satellite image super-resolution algorithm I found because it’s designed for much-higher-resolution (thirty-centimeter) input imagery.

Removing modern features

One problem with using satellite photos as the base for historical maps involves dealing with modern features: agriculture, cities, roads, etc., that weren’t around in the same form in the time period the historical map is depicting. Machine learning presents a solution for this problem, as well; Photoshop’s content-aware fill allows you to select an area of an image for Photoshop to plausibly fill in with similar content. For example, here’s the Gigapixel-enlarged image with human-created features removed by content-aware fill:

Modern features no longer appear in the image.

I made these edits by hand, but at scale you could use OpenStreetMap’s land-use data to mask candidate areas for content-aware replacement:

Data from OpenStreetMap shows roads, urban areas, farmland, etc.

Conclusion

If you want to work with satellite imagery to produce a high-resolution basemap for historical or Bible maps, then using machine learning both to sharpen them and to remove modern features could be a viable, if time-consuming, process. The image in this post covers about 100 square kilometers; modern Israel is over 20,000 square kilometers. And this scene contains a mostly undeveloped area; large-scale cities are harder to erase with content-aware fill because there’s less surrounding wilderness for the algorithm to work with. But if you’re willing to put in the work, the result could be a free, plausibly realistic, reasonably detailed map over which you can overlay your own data.

Using 3D Software to Enhance the Resolution of Bible Maps

Friday, December 28th, 2018

The problem with using satellite photos for Bible (or other historical) maps lies in their photographic nature–they present the world as it is, with modern cities, agriculture, land use, and other infrastructure that didn’t exist in the ancient period that the maps are depicting. However, satellite maps are useful in showing “true-color” views and revealing features like transitions from deserts to wetlands.

If you’re not using satellite photos for the Bible maps you’re creating, you’re using other data, like elevation; indeed, with only elevation data, you can produce a variety of map styles. Shaded relief shows hills in a naturalistic way, approximating the look of satellite images. A hypsometric map, where the map color changes with elevation, also depicts this data, though I would argue that hypsometric maps can be misleading if they transition from green colors at low elevations to brown colors at higher elevations, since people have become used to satellite photos with these colors as depicting land cover.

The main problem with relying on elevation data (a digital elevation model, or DEM) is its relatively low resolution; until 2015, a 90-meter resolution (i.e., one pixel of elevation data corresponds to an approximate square 90 meters by 90 meters) was the highest resolution freely available worldwide (well, mostly worldwide). In 2015, the SRTM worldwide elevation data became available at a 30-meter resolution, or 9 times higher resolution than previously. Also in 2015, similar ALOS 30-meter data became available. If you’re willing to pay tens or hundreds of thousands of dollars, you can also find proprietary elevation data at resolutions of 5 meters. Most of us aren’t in a position to pay that kind of money, however, so I’m interested in free data.

Bible atlases produced before 2015 almost certainly use the coarser 90-meter resolution, while Bible atlases produced since (though as of late 2018 I’m not aware of any) would likely use the 30-meter resolution and can zoom in much further without becoming blurry.

However, 30 meters feels rough compared to the satellite imagery available in Google Maps, which is often at 30 centimeters. Even free imagery from the European Sentinel-2 project is available at 10 meters, or 9 times higher resolution than 30 meters.

DEM Enhancements

The question I have is whether it’s possible to enhance a 30-meter DEM to bring it closer to the high resolution that Google Maps is training us to expect on maps everywhere.

To answer that question, I turned to Terragen, 3D modeling software designed to render photorealistic landscapes. (I actually tried several different programs, but Terragen was the least confusing.) Terragen and similar programs procedurally improve resolution by adding fractal enhancement–in other words, they extrapolate from the available data to add plausible, if fake, detail. My process was the following:

  1. Find a high-resolution DEM to use as a reference for the output of the process.
  2. Downsample the DEM to 30-meter resolution to match the DEM available worldwide.
  3. Enhance and style the DEM in Terragen to mimic a satellite photo.
  4. Compare the output.

The U.S. Geological Survey has started making elevation data available at a 1-meter resolution for select parts of the United States. I picked a desert area near Dayton, Nevada, that roughly matches the terrain of ancient Israel (since Israel will probably be the subject of most Bible maps).

I converted the USGS .img file into a geotiff using gdal_translate and resampled it to 30-meter resolution using gdalwarp -tr 30 30 USGS_NED_one_meter_x27y436_NV_Reno_Carson_QL2_2017_IMG_2018.img nv-30.tif.

The result was two tiffs that I imported into Terragen. After that, I spent some time coloring and styling them, with the below results:

Comparison of six different views of the same scene.

This image shows 1-meter shaded relief, 30-meter shaded relief with blurry bicubic resampling, 10-meter publicly available satellite photo that I slightly retouched, 1-meter colored and enhanced in Terragen, 30-meter colored and enhanced in Terragen, and the Google Maps view for this area.

I feel like the 30-meter Terragen view, which is what you could plausibly produce for Bible maps, looks pretty OK, actually–though a trained 3D artist would do better. The 1-meter data, while accurate, reproduces modern features like the road on the right side, which is unhelpful for Bible maps–mitigating modern features is the one of the main points of this exercise. While the 30-meter view doesn’t have all the detail of the 1-meter version, the rendering feels plausible to me.

Of course, “plausible” doesn’t mean “accurate,” and there’s the question of whether it’s ethical to enhance terrain in this way–you’re essentially inventing detail that doesn’t exist in the source data, which could mislead someone if they believe that the detail reflects reality. It depends how far you want to push the idea that all maps are in some way plausible fictions.

Scaling Up

What’s needed to implement this technique in production?

  1. A base map to use for coloring (I’d use Natural Earth II–I tried it in the Nevada scene and think it could work–but you could also use satellite imagery or your own colors).
  2. A way to export and reproject the finished product. My free version of Terragen can only export images 800 pixels wide; you’ll probably want to export them at over 10,000 pixels wide. And then you’ll need to stitch them together and reproject them to Web Mercator to display them in online mapping applications.
  3. A way to layer the images with other data (such as bodies of water and labels).
  4. A delivery mechanism (probably tiles over the Internet, as with Google Maps and most mapping applications).

Conclusion

This approach represents a plausible way to improve the resolution of Bible maps or other historical maps using only publicly available, free data. Although it creates some ethical problems, with proper disclosure it could potentially be a useful way to make Bible maps more compelling and zoomable.

Update March 2019: See the followup post, Using Machine Learning to Enhance the Resolution of Bible Maps.

Street View through Israel

Thursday, January 17th, 2013

Google yesterday announced that they’ve expanded their street view functionality throughout Israel, including a number of sites that you’d visit on any tour of the Holy Lands. Of particular note are the archaeological sites they walked around and photographed. Here, for example, is Megiddo:


View Larger Map

Previously available were many places in Jerusalem, like the Via Dolorosa. But the new imagery covers much more area–I can imagine it being particularly useful in Sunday School and classroom settings, where a semi-immersive environment communicates more than static photographs.

Via Biblical Studies and Technological Tools.

Zoomable Map of the Greco-Roman World

Thursday, October 4th, 2012

The Pelagios Project has produced a lovely zoomable map of the Greco-Roman world. Below, for example, is a static view of Israel during the Roman period.

A blog post about the map discusses how they created it (plus bonus technical background). I’m most impressed by how attractive the maps are—a lot of online maps present you the data but don’t try to be beautiful; this map succeeds on both counts.

More generally, the Pelagios Project, which I admit I hadn’t heard of before today, incorporates linked data to help people study the ancient world. It encompasses a variety of efforts (need to search for an inscription from ancient Palestine? No problem)—it’s all fascinating.

Terrain-shaded map of Roman Palestine (Israel) showing topography, cities, roads, and other features.
(Note the “Mortuum Mare” instead of the “Dead Sea.”)

Via O’Reilly Radar.

Calculating the Time and Cost of Paul’s Missionary Journeys

Thursday, July 5th, 2012

Stanford University recently unveiled ORBIS, a site that lets you calculate the time and cost required to travel by road or ship around the Roman world in A.D. 200. It takes into account a lot of factors—my favorite is that it models ancient sea routes based on historical sources and wave height.

A view of the Mediterranean, including Roman cities and roads, from ORBIS.

The apostle Paul went on three missionary journeys from A.D. 46 to 57, traveling around much of Asia Minor and Greece. In 60, he was also taken to Rome. ORBIS allows us to calculate how long these journeys would have taken in pure travel time (excluding time spent at each destination) and how much they would have cost.

Journey Distance (miles) Travel Time (days) Cost per Person (denarii)*
First 1,581 53 237
Second 3,050 100 314
Third 3,307 92 481
Rome 2,344 36 699

* Ship travel only. According to Wikipedia, the denarius from 200, used here, is roughly 22% weaker than a denarius from the mid-first-century.

I conclude a few things from this exercise:

  1. The journeys get progressively costlier as more of each journey happens by ship. Sailing is fast but expensive—of course, Paul and his companions may not have had to pay the full fare.
  2. I like to imagine that Paul’s overnight escape from Thessalonica to Berea was partially by riverboat (though the costs above assume it was by road).
  3. Not much of the route of Paul’s journey is in doubt—Luke describes the trips pretty precisely in Acts. About the only question is whether Paul traveled from Berea to Athens by ship or by road. The above costs follow the ESV Study Bible and assume it was by ship.

For more about Paul’s missionary journeys, Dale Bargmann has written a good walkthrough with maps and photos.

Download the raw data (Excel).

Bible Geography in Tableau

Saturday, September 25th, 2010

Robert Rouse combines Bible geo data with Tableau to produce an interactive map that uses size to emphasize important places and allows you to filter the data by book:

Bible Places
Bible Places

He ‘s also written a blog post that goes into detail about the map. The blog is about technology and the Bible, so take a look at his other posts if those topics interest you.

Google Static Maps API

Thursday, September 11th, 2008

Google just updated their Static Maps API to include satellite imagery, and the atlas now uses this API to display thumbnail maps.

The atlas previously used pregenerated images that looked like this:

A custom satellite map of Jerusalem shows about two degrees of latitude and longitude as context. Jerusalem appears near the top of the map.

Now the image for Jerusalem looks like this:

A Google Map of Jerusalem also shows two degrees of latitude and two degrees of longitude, but Jerusalem appears centered in the map.

The Google Static Maps API is a way to get all the nice imagery of Google Maps without incurring the interactive overhead. It’s useful in situations where, like an atlas, you just want to show a static image. Until yesterday, you could only get street maps in the Static Maps API.

This change benefits you—you always see up-to-date imagery—and it’s easier for me, since I don’t need to regenerate images if the locations change.

“Satellite Images” of Bible Events

Monday, December 17th, 2007

Have you ever wondered what the parting of the Red Sea would have looked like from a satellite? Probably something like this:

A fake aerial view of Moses and the Israelites walking through the Red Sea.

An Australian group produced four fake aerial views of Bible events (Adam and Eve in Eden, Noah’s Ark on Ararat, Jesus’ crucifixion, and crossing the Red Sea) for the recent Miami art fair. The group is working on producing satellite images of other historical and mythological events.

Digital Resources for Bible Mapping

Sunday, December 16th, 2007

Mark at Biblical Studies and Technological Tools has been preparing for his BibleTech08 talk on Biblical mapping by asking his readers for their thoughts on Bible maps. Here are my responses to some of his questions.

First, I can see Bible software moving in two directions as it relates to mapping:

Outsource It: Mapping in Bible Software, Approach #1

Mapping has never been a strength of Bible software (with the possible exception of Accordance). But that’s not necessarily a problem.

Why should Bible software try to reproduce Google Earth’s features, with 3D terrain, zooming, rotating, layers, etc.? It’ll inevitably pale in comparison to Google Earth. In other words, no Bible software company is going to out-feature Google.

Rather, Bible software companies should build on existing software and innovate where they can.

Here’s what a Bible software company that wants to take this approach should do:

  1. License or commission attractive maps that allow minimal interactivity. I imagine that a lot of people simply want a map to print or to use in a class. Google Earth doesn’t support this task well.
  2. Identify place names in Bibles and reference works in their software and link these places to geocoded data. People will be able to see quickly where a location is without disrupting their immediate tasks. This kind of deep integration among resources is invaluable.
  3. Allow the export of this data into KML or other open formats so people who want a particular view can use Google Earth (or a similar program) to create it. They can then share these views with others.
  4. Release geocoding data under a Creative Commons license to allow people to reuse it. A lot of biblical regions don’t have any boundary data available on the web at the moment, for example, and it’s better to have people who know what they’re doing draw these boundaries instead of random people with lots of free time. (This last step may not be appropriate for every company.)

Integrate It: Mapping in Bible Software, Approach #2

Maybe a Bible software company really wants to add a Google Earth-style application to their program (perhaps to make sure their data stays proprietary, which I can understand). How should they do it?

They should integrate World Wind, an open-source earth viewer developed by NASA. It comes in both .NET and Java flavors. The i-cubed layer has 15-meter full-color resolution for most of the earth, which is sufficient for most purposes. It can also use Microsoft’s Virtual Earth imagery.

I think you could create a lot of interesting maps and geographic applications if you were willing to customize the World Wind interface for Bible mapping and integrate this data deeply into your software.

The following image, for example, from a post about Herod the Great’s tomb, uses the i-cubed imagery in World Wind:

View of Herodium showing the Dead Sea, Jericho, the Jordan River, the Sea of Galilee, Mount Hermon, and Jerusalem.

What Makes Maps Useful?

I’m only answering for myself here, but I tend to judge a map on its aesthetics—in other words, I prefer a nice-looking map even when it’s otherwise inferior to an ugly map. A lot of Bible maps on the web just aren’t very attractive.

If two maps are equally attractive, I’ll use the one that gives me more flexibility to accomplish what I want or to increase my understanding—enabling layers or places, for example.

Finally, I don’t find static 3D cutaways (like the above image of Herod the Great’s tomb) very useful—they’re cool to look at, but the distortion in perspective makes it hard to measure distances or see how places relate to each other. However, I do find it useful to pan down in Google Earth. So I like standard overhead views for static maps but prefer dynamic maps to give me maximum flexibility.

How People Use the Maps Here

Judging from their search keywords on Google, people are looking for three main things when they come to OpenBible.info. Of course I don’t know what their ultimate aim is, but here are their immediate goals:

  1. An overview of Bible geography.
  2. The location of a specific place that they probably encountered in their Bible reading.
  3. Integration of Bible places and Google Earth or Google Maps.

Map Features

Here are some things I’d like to see in Bible maps in the future:

  • Social integration. I don’t really know what it would involve, but a lot of mapping sites are moving to allow collaboration and sharing of maps created by users. I can imagine a lot of potential here to eliminate duplication of effort—how many people have had to create new maps just because the particular one they wanted didn’t exist? By sharing maps, the likelihood increases that someone has already created the map you want.
  • Reference material about each place. If I taught a graduate or undergraduate class on Bible geography, I’d have each student write a brief summary of several places in the Bible and then release these summaries under a Creative Commons license. Then I’d integrate them into the KML files available on this site, perhaps with some links to Wikipedia or other resources for more information. In other words, I’d like to see the KML files on OpenBible contain some up-to-date scholarship on each place, so people learn more than just a place’s coordinates when they come here. It’s similar to what BibleMap.org does by including articles from the ISBE (a public-domain Bible encyclopedia). Unfortunately, all the public-domain resources show their age in terms of language and scholarship. At the very least, I’d like to link Bible places that have Wikipedia entries to their corresponding articles.
  • City maps. I’d like to see city plans from various time periods. I find such maps helpful because satellite imagery can’t help you reconstruct the plans. Even better would be to geolocate the maps, so you can browse them in Google Earth and see their relation to modern cities. BibleMaps.com has about twenty biblical city maps available to buy. I’d like to see city maps implemented purely in KML as polygons, paths, and points. I’ve created a simple version of Nineveh in KML as a proof-of-concept.
  • Photos. I’ve worked on aggregating some photos of Bible places, but the potential exists for a lot more. HolyLandPhotos.org has a nice, free virtual tour of selected sites (Beersheba, for example). I’d like to see this kind of approach on a larger scale—or even integrated right into Google Earth.
  • Using the new terrain layer on Google maps. Satellite maps are great, but sometimes a terrain map shows things more clearly. For example:
    See a shaded-relief version of Israel’s topography at Google Maps
  • More Creative Commons-licensed data. Political boundary and road data are conspicuously absent from the OpenBible data set. I’ve said before that making a lot of Bible data available under open licensing will allow people to develop new views and understandings of the Bible, which in turn will let Bible software developers integrate refined versions of these advances into their products. But, again, no one should feel compelled to release work only under Creative Commons; people deserve compensation.
  • International resources. This site gets a lot of visitors from people outside the U.S. They simply may not have access to the biblical resources we have here—or the ability to spend a lot of money on Bible reference materials. In any case, international interest in Bible maps is probably extensive. Maps have some internationalization issues (with place names), but not nearly to the extent that, say, Bible commentaries do.

Conclusion

Thanks to Mark for his recent roundup of the latest goings-on at OpenBible.info and for his explanation of how to find all the mentions of a place in the Bible.

I hope Mark will make the slides from his BibleTech talk available online. I look forward to seeing what he has to say.

New Feature: Photos of Bible Places

Monday, December 3rd, 2007

Browse 9,500 photos taken near 580 biblical locations. For example: Beersheba, Capernaum, and Ur.

More examples:

See this aqueduct on Flickr
Aqueduct at Caesarea by hoyasmeg

See these gates on Flickr
Gates at Dan by callmetim

See these rooftops on Flickr
Rooftops at Babylon by labanex

Background

Photo-sharing site Flickr has an API that lets you find photographs by latitude and longitude. The Bible Geocoding section of this site has lots of data arranged by latitude and longitude. Why not use the Flickr API to find photos that people have taken near places in the Bible?

The resulting photos are of varying quality for getting an idea of what a place looks like. Remember, people didn’t necessarily take these photos with the intent of giving you an overview of the landscape. The photos reflect personal interests—maybe someone saw an interesting flower that just happens to be near a biblical landmark. So don’t expect every photo to be relevant or every place to have lots of photos.

Technical Notes

Every night, a program on this server queries the Flickr API to find any new photos taken near the biblical locations. Then it saves these photos to a database, indexed by location for easy retrieval.

The program treats copyrighted and Creative-Commons-licensed photos the same way— thumbnails are OK for copyrighted photos. In the future, I may feature CC-licensed photos more prominently. Only about 2,000 of the 9,500 photos are CC-licensed.

Future Directions

Right now, you can only get to the photos by browsing them by place. I hope to integrate the photos into the Bible atlas somehow.

I’d also like to let people vote on helpful or unhelpful photos to better prioritize the photos.

It may be possible to use Flickr tags to find non-geocoded photos of Bible places, but I’m not sure how to perform such a task automatically. I’m certainly open to suggestions.

What You Can Do with the Photos

I don’t own the photos; the photographers do. If you want to use a photo for something, click on it to go to its Flickr page. Then check its licensing terms. If it’s copyrighted, you need to secure permission from the photographer before you use it. If it has a Creative Commons license, you have more freedom to use the photos, depending on the terms of the license.

I recommend Todd Bolen’s BiblePlaces.com for professional-quality, affordable photos of places in the Holy Land, especially Israel. His photos give you lots of perspectives and work especially well for presentations. Compare Todd’s photos of Engedi to OpenBible’s photos of Engedi, for example, to see how his photos help connect you to the biblical narrative.