Skip to content

Instantly share code, notes, and snippets.

View rsimon's full-sized avatar

Rainer Simon rsimon

View GitHub Profile
@rsimon
rsimon / record-sample.json
Last active August 26, 2022 09:00
An example record list (with a single record)
[
{
"@id": "http://www.example.com/access-link",
"title": "Record title",
"type": {
"label": "Video"
},
"descriptions": [
{
"value": "This record's description",
@rsimon
rsimon / linked-places-sample.json
Last active August 26, 2022 08:48
A Peripleo-compatible "gazetteer" (with a single LP place record)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rsimon
rsimon / App.jsx
Last active April 25, 2021 11:30
Minimal example for using https://annotorious.com in React
import { useEffect, useRef, useState } from 'react';
import { Annotorious } from '@recogito/annotorious';
import '@recogito/annotorious/dist/annotorious.min.css';
function App() {
// Ref to the image DOM element
const imgEl = useRef();
@rsimon
rsimon / annotorious-opencv-find-contours.js
Last active March 1, 2024 08:00
Sample code for AnnotoriousOSD that automates polygon selection by tracing contours in the selected image section.
import OpenSeadragon from 'openseadragon';
import * as Annotorious from '@recogito/annotorious-openseadragon';
import '@recogito/annotorious-openseadragon/dist/annotorious.min.css';
/*************************************************************************
*
* Basic concept for this is from the official OpenCV docs:
* https://docs.opencv.org/3.4/dc/dcf/tutorial_js_contour_features.html
*
@rsimon
rsimon / annotorious-helloworld-plugin.js
Created September 11, 2020 09:45
Annotorious/Recogito 'Hello World' Example plugin
var HelloWorldPlugin = function(args) {
var currentColorBody = args.annotation ? args.annotation.bodies.find(function(b) {
return b.purpose == 'highlighting';
}) : null;
var currentColorValue = currentColorBody ? currentColorBody.value : null;
var addTag = function(evt) {
if (currentColorBody) {
@rsimon
rsimon / annotorious-firebase.html
Last active December 16, 2023 20:19
Using Firebase as Annotation Backend for Annotorious
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Annotorious | Firebase Demo</title>
<link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet">
<style>
html, body {
padding:20px;
margin:0px;
@rsimon
rsimon / webanno_example.md
Last active November 21, 2019 14:31
Recogito IIIF + WebAnno example
{
"annotation_id":"e8698b97-1722-49ee-9752-c8a4ae2863ba", # UUID for this annotation
"version_id":"6c89639b-87c7-4f75-8f37-96212e8eef36", # separate UUID for this specific version
"annotates":{
"document_id":"7tqppvg1uo4qdo", # ID & content type of document/filepart the annotation annotates
"filepart_id":"5db80aa5-8a27-4539-aeb3-bddf3abc0098",
"content_type":[
"TEXT",
"TEXT_PLAIN"
]
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
Title,Geometry,DateTime,ItemType,Dataset,ConflatesNo
Faroe Islands,"MULTIPOLYGON (((-6.916 61.65, -6.879 61.627, -6.943 61.593, -6.751 61.574, -6.748 61.541, -6.841 61.56, -6.702 61.487, -6.824 61.471, -6.717 61.46, -6.677 61.392, -6.869 61.474, -6.996 61.602, -6.916 61.65)), ((-6.706 61.638, -6.699 61.631, -6.723 61.631, -6.706 61.638)), ((-6.758 61.705, -6.749 61.701, -6.737 61.685, -6.763 61.683, -6.758 61.705)), ((-6.946 61.914, -6.813 61.898, -6.633 61.828, -6.687 61.753, -6.776 61.831, -6.877 61.819, -6.946 61.914), (-6.808 61.829, -6.811 61.828, -6.808 61.829, -6.808 61.829)), ((-6.846 61.785, -6.808 61.779, -6.79 61.751, -6.853 61.762, -6.846 61.785)), ((-7.666 62.102, -7.661 62.1, -7.688 62.097, -7.666 62.102)), ((-7.596 62.117, -7.579 62.115, -7.528 62.095, -7.665 62.102, -7.596 62.117)), ((-6.324 62.305, -6.285 62.281, -6.341 62.278, -6.325 62.243, -6.416 62.271, -6.324 62.305)), ((-6.524 62.299, -6.515 62.277, -6.424 62.253, -6.538 62.254, -6.445 62.181, -6.572 62.224, -6.535 62.174, -6.554 62.169
@rsimon
rsimon / test.html
Created March 8, 2018 12:21
'Remote control' OpenLayers through a DOM element that obstructs direct access
<html>
<head>
<link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">
<style>
#above, #below {
position:absolute;
top:0;
left:0;
width:640px;
height:480px;