Workflow for Georectifying Large Map Images

The other day, I was trying to figure out what I would do about georectifying images of historic (C19 CE) maps from an Ottoman-era atlas held by the Library of Congress. The TIFF files were too big to upload to MapWarper, my preferred space, and the JPEGs were too low-res, even the large ones. It occurred to me that I have used libtiff‘s tiffcp in the past to reduce TIFF filesize, and a workflow was born. (Though I don’t use Homebrew for package management on my machines, I do have it installed on my home laptop and it made getting libtiff set up easier.)

  • Download 254MB TIFF from https://www.loc.gov/resource/g3200m.gct00235, page 61
  • Install libtiff from Homebrew and process the TIFF using tiffcp. Parameter explanation:
    • -r sets the strips per row. Don’t ask me what this really means, but I got away from an error by setting this.
    • -c sets the kind of compression. Similarly, I’m not real deep on compression algos, but I knew I wanted a JPEG output
    • :75 sets the compression quality. If you’re used to working in a graphics editor GUI
  • brew install libtiff
  • tiffcp -r 16 -c jpeg:75 {/path/to/your/download/file}.tif {/path/to/your/output/file}.jpg

Upload the file to mapwarper.net or your preferred georectification service and rectify, producing the conformed map.

From there, I can use http://mapwarper.net/maps/tile/23528/{z}/{x}/{y}.png in a Leaflet map overlay (which is what I’m going to do).

 

Web Map with No Baselayer

In my MA thesis project (I can’t get my head around calling it a thesis, since it’s not just a printed textual destination), I’m making some web-based maps to illustrate and further my argument for privileging or at least equally including histories of Islamic and vernacular education in the histories of education in the C19 Senegambian region. At the moment, I’m thinking I’m going to want a georeferenceable space to make a claim about ca. 6th century AH Islamo-Arab world maps. However, those maps are south-up maps, or at least all the ones I’ve seen are. in order to do things like drop markers on the map and talk about how long western African people included Arabia and/or the greater Islamic world as part of their cosmology, I want an image of one or more of these maps in a map-like web space.

Nicely, Leaflet lets me do this. When I started researching, I assumed that this would have to be done as a hack or by making my own tileset from an image of the color I want to use. The latter is roughly the answer opted for in a Stack Overflow Q/A. Reading that, though, reminded me I hadn’t — as I often don’t — thought of the Occam’s Razor version. When I went back to look at the code for adding a map in Leaflet, it turns out you can just not add a baselayer. The Leaflet 1.2.0 spec only says that you have to pass the creation method either a DOM ID to the DIV element that will contain your map or an HTMLElement. You may pass map options, but they are optional. a-hah-hah.

Next step is to see if I can manipulate the color that shows up absent a baselayer.

 

PhantomJS Failure During Mirador Install

Today I tried to install Mirador in a dumb Docker container, partly to make a point to some devs that what I wanted them to do wasn’t very hard. (That is, if I could do it from scratch in a day knowing very little about Mirador, IIIF, NodeJS, and Docker, surely they didn’t need to take the half-week I was quoted. From being a full-time web dev, I know that logic does not hold rigidly, but it’s not too far off.)

My first blocker was a failure of PhantomJS to install. It’s possible my next post will be that I was installing a dev version of Mirador that I didn’t need to install, but we’ll see. In any case, what I think was the material portion of the error spew was

npm ERR! phantomjs-prebuilt@2.1.15 install: `node install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.15 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! 	node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! 	npm bugs phantomjs-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 	npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.

Since my knowledge of all these things is very shallow, it took me longer than it might have to figure out what phrase from that to search on, but eventually I landed upon — natürlich — a Stack Overflow response to a more generic question about installing Node packages on Ubuntu that helped me. Indeed, running sudo apt-get install nodejs-legacy allowed the npm install portion of the Mirador process to continue to a successful conclusion.

 

Local 33 Protest, 22 May 2017 (Yale Commencement)

This was taken through a 75-year-old window intentionally made slurrily to mimic being even older. Also, apologies for the verticality. I don’t take a lot of quick-reaction video, so I forgot to horizontalize. York Street, New Haven, CT.

 

Kristallnacht Timeline

Made for HIS 575, Spring 2016, Southern Connecticut State University, Professor Troy Paddock

 

Some Working SPARQL

Since I’m trying to work on learning SPARQL (and Learning SPARQL) with a goal of working with data from the Yale Center for British Art, I’m testing what I know in their SPARQL endpoint. This is just a log of some currently working queries.

Get everything about one item (id = 499) and then find every other YCBA object with which it shared an exhibition.

SELECT DISTINCT ?o ?s WHERE {
	ycba:object\/499 ?p ?o .
	?s crm:P12i_was_present_at ?o .
}

This query could be collapsed into one line, but exploding it like this highlights the way the natural language works.

Or, if I know an exhibition ID, show me every object that was in it.

SELECT DISTINCT *
WHERE {
   ?s crm:P12i_was_present_at ycba:exhibition\/7 .
}

Next I’ll try to combine these notions and start with an exhibition name or similar, and work out the web of shared objects.

 

Learning LOD

For a side summer project, I’ve taken on figuring out how to obtain and work with Linked Open Data (LOD). The Yale Center for British Art transformed their collection data into LOD a couple years back, so they provide a nice local source for the data. As far as I can tell right now, the project entails learning (just enough of) SPARQL and RDF parsing, and possibly improving my Gephi or Cytoscape chops. Meaning, of course, that the third part is needing to figure out what can be done with YCBA’s data and learning how to do that.

Off the cuff, I think these are the most relevant pre-existing factors affecting whether this post is comprehensible and useful for you:

  • MacBook Pro from late 2014; 2.2 GHz processor, 16 Gb RAM
  • Python 2.7.6
  • pip 7.0.1
  • Experience writing code as well as working with relational databases and SQL
  • Experience administering a server
  • Perhaps most importantly, before this week I spent a little time with Bob DuCharme’s Learning SPARQL from O’Reilly. Also possibly available at a library near you.

What I did today to get meaningful results:
First I needed to give my Python the capability of addressing a SPARQL endpoint and parsing the results.
sudo pip install rdflib (this also installs isodate, SPARQLWrapper, and html5lib)
sudo pip install simplejson
Then I executed some this Python fragment from Semantic Web:

from SPARQLWrapper import SPARQLWrapper, JSON

sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setQuery("""
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    SELECT ?label
    WHERE { 
      <http://dbpedia.org/resource/Asturias> 
      rdfs:label
      ?label .
    }
""")

sparql.setReturnFormat(JSON)
results = sparql.query().convert()

for result in results["results"]["bindings"]:
      print result["label"]["value"]

And got back these results:

Asturias
منطقة أستورياس
Asturien
Asturias
Asturies
Asturie
アストゥリアス州
Asturië (regio)
Asturia
Astúrias
Астурия
阿斯图里亚斯

With that in hand, I played around with the SPARQL query a bit to get other parts of the DBPedia entry. (After a brief visit to Wikipedia to learn a bit more about Asturias.)

This feels good enough for today. Next thin, I think, is to press some more on Learning SPARQL and see what else I can ask DBPedia.

Update 12 June: Fixed omission of sudo before second package install. Added that I have Pip, and where to get it.

 

Animated GIFs :: Pixelmator v Photoshop v Acorn v GIMP

Can’t believe I forgot GIMP in that last note, but it’s been updated.

I wanted to edit an animated GIF, so I had cause to check out which editors could do it.

Animated GIFs
Acorn: No (sin of omission)
Pixelmator: No
GIMP: Yes
Photoshop: Yes
 

Defined Size Selection :: Pixelmator v Acorn v Photoshop v GIMP

Creating a defined selection box of X pixels by Y pixels
Pixelmator: No
Acorn: Yes
Photoshop: Yes (link is to one description of doing this in an older version, but I expect it’s been substantially carried forward.)
GIMP: Yes

In my efforts at work to find a Photoshop alternative with a significantly lower cost, I’ve purchased both Pixelmator and Acorn. Last fall I worked mostly with Acorn, and I’m hoping to use Pixelmator more this fall with the DOCC node I work with.

Update 30 Apr 2015: Added GIMP

 

Toujours Animated GIFs

Last night’s lab for DOCC 14 (known to me equally as WGSS 380) focused on animated GIFs. It’s fascinating to see how GIFs have changed from my early days using the web (You guys! We can make little cartoons!) to now. This is not that blog post, though. This is just to post the two GIFs I made to talk about making GIFs but also to explore their power to encapsulate a moment and hang on to it for (apparently) all eternity. If you know It Happened One Night, you know where this GIF is situated. If not, I interpret this moment as the instant Clark Gable’s reporter/rake realizes that his thumb is not as powerful as he’s made it out to be (hmm now) to Claudette Colbert’s heiress. The dénouement comes later in the scene as she uses her sexuality to perform where he couldn’t.

it-happened-one-night_hitchhiking

This one’s slowed down a touch, to emphasize Gable’s forlorn look at the thumb.

it-happened-one-night_hitchhiking-2