Give a string with the name of the image-file that was annotated with the Annotation Compass; Return a string that includes all annotation-texts plus html-tags that place them back into their original position.

Input

  • image [str]

Output

  • vernacular_map [str]

Endpoint

https://hub.xpub.nl/soupboat/si16/api/vernacular_map/ ? image=<image>

Try it



vernacular_map

Give a string with the name of the image-file that was annotated with the Annotation Compass; Return a string that includes all annotation-texts plus html-tags that place them back into their original position.

def vernacular_map(image: str) -> str:

    """Give a string with the name of the image-file that was annotated with the Annotation Compass; Return a string that includes all annotation-texts plus html-tags that place them back into their original position."""    

    from urllib.request import urlopen
    import json

    url = f"https://hub.xpub.nl/soupboat/si16/annotation-compass/get-labels/{image}/"
    response = urlopen(url)
    data_json = json.loads(response.read())

    filtered_map = '<link rel="stylesheet" href="/soupboat/si16/static/css/jian.css">'
    for label in data_json['labels']:
        html_tag = f'<p style="left: {label["position"]["x"]}%; top: {label["position"]["y"]}%; position: absolute;">{ label["text"] }</p>'
        filtered_map = filtered_map + html_tag

    return filtered_map

This function was built for a project where individuals are invited to add their annotations on a map using the Annotation Compass. Each annotation-label is stored in a json-file and includes the annotation-text itself, but also the name of the image-file as well as the position, size, index, timestamp and userID of the annotation.

Example for a label:

{'image': 'map.jpg',
'position': {'x': 12, 'y': 97},
'size': {'width': 43, 'height': 18},
'text': 'This is a text! Is this a text?',
'timestamp': 'Wed, 01 Dec 2021 14:04:00 GMT',
'userID': 5766039063}

If interested in all annotations vernacular_map() can help. The function needs a string with the name of the of the image-file that was annotated with the annotation compass tool. The output is a string that includes all annotation-texts plus html-tags that place them back into their original position.

How to get a json-file with annotation-labels?

https://hub.xpub.nl/soupboat/generic-labels/

The Annotation Compass allows people to uplaod an image and ask others to annotate it. A json-file of the annotations is provided.

Examples

In this example, the function returns all annotation-texts

vernacular_map('rejection_map.jpg')
'<link rel="stylesheet" href="/soupboat/si16/static/css/jian.css"><p style="left: 63.9896%; top: 34.2958%; position: absolute;">here, someone called my behaviour "strange"</p><p style="left: 33.6269%; top: 65.1408%; position: absolute;">윰보에서 장을 보고 집에 돌아오는 길. 두 명의 남자 가 다가왔어. 나는 낑낑대며 나의 일주일간 식량을 옮기고 있었지. 쾅!\n큰 소리가 났고 나는 순간 움츠러들었어. \n건너편에서 다가오던 남자 두명이 크게 웃더니 \n나를 보며 Chino! Chino!라고 외쳤어. 시발.</p><p style="left: 92.3483%; top: -0.179426%; position: absolute;">the municipality of rotterdam (prince alexander) almost refused to approve my request of registration because the italian id card doesn\'t have my sex written on it. \nthey said that if i bring my birth certificate that states that im a male i can have my bsn otherwise.......... nope.</p><p style="left: 65.3034%; top: 35.4839%; position: absolute;">getting a text message from my good friend, telling me that she will not visit me in Rotterdam despite she promised me.</p><p style="left: 48.135%; top: 20.4458%; position: absolute;">house viewing 2: meeting with some girls in the evening to see a room; felt super exposed and awkward. Later on, they rejected me.</p><p style="left: 76.25%; top: 69.5246%; position: absolute;">I once went to view a house here but it didn\'t have the floor. crap.</p><p style="left: 39.3264%; top: 46.831%; position: absolute;">here, someone screamed at me "move fucking chinee"</p><p style="left: 77.0%; top: 63.7521%; position: absolute;">other housing rejection situations here.\n</p><p style="left: 63.7806%; top: 41.0296%; position: absolute;">a woman on the train showed me the middle finger the first day i arrived to rotterdam and i didn\'t really understand why because she\'s the one that was mean with me in the first place</p><p style="left: 48.9886%; top: 51.256%; position: absolute;">at 22:01 a bald man kicked us out from the basketball court because we were noisy</p><p style="left: 36.5285%; top: 54.2958%; position: absolute;">here, someone screamed at me, right into my face, something I could not understand</p><p style="left: 55.0889%; top: 15.6154%; position: absolute;">the most unpleasant house viewing: my viewing overlapped with the previous person and I didn\'t got the chance to connect with the ones living them. How could then they know who I am and even consider me for the room?</p><p style="left: 47.2668%; top: 70.1459%; position: absolute;">Stepped out at the wrong bus station and because the waiting time for the next bus was (a bit) long, Carmen and I decided to walk to Varia... Rejected by punctuality.</p><p style="left: 42.5389%; top: 45.7042%; position: absolute;">here, someone told me to move away</p><p style="left: 45.2507%; top: 29.3907%; position: absolute;">I had the most awkward house viewing here. The people barely talked to me and really let me know that they didn\'t like me. Obviously, I did not get the room.</p><p style="left: 60.774%; top: 59.7488%; position: absolute;">rejected by the police</p><p style="left: 42.0882%; top: 18.8014%; position: absolute;">my first house viewing: I was really hopeful about this one, actually, because I felt a connection with the girl. I waited 2 weeks to be rejected from this one.</p><p style="left: 39.1192%; top: 36.2676%; position: absolute;">here, someone told to stop looking at them</p><p style="left: 43.7995%; top: 27.0609%; position: absolute;">I had the most awkward house viewing here. The people barely talked to me and really let me know that they didn\'t like me. Not surprisingly, I did not get the room.</p><p style="left: 75.285%; top: 29.2254%; position: absolute;">어딘지 잘은 모르겠지만, Kralingen 쪽이었던 것 같아. bsn 거주등록을 위해 학교에 갔는데, 시청에서 나온 사람들이 나의 룸메이트 ID card가 필요하다며 거절했지. 나의 아침을 날렸어. 나의 룸메가 나에게 ID card 사진을 보내줬지만, 그들은 서명이 같지 않다면서 다시 거절했지. </p><p style="left: 52.0%; top: 48.1324%; position: absolute;">i couldn\'t eat anything from a spar because it was selling only non gluten-free products. </p><p style="left: 16.5775%; top: 28.7791%; position: absolute;">I felt rejection in Art Rotterdam 2019 when the parents of my boyfriend\'s exgirlfriend came to visit my exboyfriends exhibition there and I felt kinda OUT OF PLACE? heheheh </p><p style="left: 60.1554%; top: 63.3099%; position: absolute;">Emma와 함께 프린트를 하러 갔는데, 그곳에 있는 instructor가 매우 불친절했어. </p><p style="left: 65.0396%; top: 45.3405%; position: absolute;">An old friend of mine that I know from my home country also studies at WDKA. I reached out to him and suggested to hang out soon. He didn\'t want to.</p><p style="left: 46.3713%; top: 58.4289%; position: absolute;">somewhere between this line i lost my ID card. and I really wasnt aware that this could linger a lot my registration to the municipality. This kinda triggered but feeling for me, as I felt a lot disorented here, having no formal document verifying who I am and feeling guilty tat I am still not registered.</p><p style="left: 30.75%; top: 43.0391%; position: absolute;">super nice sublet. I\'ll be rejected in a month though.</p><p style="left: 60.3757%; top: 46.2333%; position: absolute;">i got ejected from a bike here.   i was just trying to move through space, but  bikes don\'t like me</p><p style="left: 49.2084%; top: 34.0502%; position: absolute;">My bike got stolen  here.</p><p style="left: 38.4744%; top: 58.0105%; position: absolute;">The first time I stayed overnight in Rotterdam, after a nice walk in the sun, I got stuck 2 hours at Centraal, because the Intercity direct broke down. I felt rejected by NS.</p><p style="left: 23.9572%; top: 33.8663%; position: absolute;">I also felt rejection in Art Rotterdam 2020 when someone I knew from a gallery decided not to say hello back after me saying HELLO.</p><p style="left: 57.625%; top: 34.3803%; position: absolute;">💫💔💥🥐🍟🍕</p><p style="left: 40.125%; top: 29.966%; position: absolute;">missed a lot of trains</p><p style="left: 51.123%; top: 18.1686%; position: absolute;">I felt rejected from some friends that made me a book but stop replying to my messages after my breakup.</p><p style="left: 44.3557%; top: 20.4458%; position: absolute;">my first no-credit-card experience</p><p style="left: 55.621%; top: 33.6313%; position: absolute;">we were going to a friends house when we got trapped into the riot against covid restrictions and a car got on fire and it was super bad to see all the anger all these people had i felt small and sad and i just wanted to run as faster as i could</p><p style="left: 39.745%; top: 19.3153%; position: absolute;">my second no-credit card experience in a super nice bar; however, they were ok with a bank transfer :D </p><p style="left: 57.9156%; top: 37.276%; position: absolute;">People throwing firework at other people here during an anti corona demonstration. </p><p style="left: 50.3743%; top: 52.0349%; position: absolute;">I felt rejected here when the friend mentioned in n3 introduced me to someone else calling me "Raquel"</p><p style="left: 73.703%; top: 49.514%; position: absolute;">i got rejected from a skateboard here. it\'s normal though because it\'s always trying to reject you and you love it anyway</p><p style="left: 58.7942%; top: 43.0025%; position: absolute;">they called me and tried to get my bank details saying that my bsn number has been used for illigal and criminal activities in amsterdam</p><p style="left: 64.4007%; top: 39.7934%; position: absolute;">my wallet rejected me for about 10 mins heree. it fell from my pocket at albert heijn but we reunited at the customer service desk. it was intense.</p><p style="left: 33.8622%; top: 34.9877%; position: absolute;">house rejection\n</p><p style="left: 5.84518%; top: 49.088%; position: absolute;">After weeks of searching I had my first interview for a room in this neighbourhood. All went well and I was hoping to move in. But in the end, I was rejected. The girl who lived there chose to have a friend move in with her. I felt a bit hopeless after that.</p><p style="left: 40.8373%; top: 7.34979%; position: absolute;">This is the intersection where I entered Rotterdam for the first time. I was driving even though I am normally a bit scared. I rejected my fears and decided to have a brave start in this city. It felt very good</p><p style="left: 0.868878%; top: 1.4485%; position: absolute;">I have never been to this area of Rotterdam, I think I rejected it for some reason.</p><p style="left: 45.8926%; top: 95.0107%; position: absolute;">I once visited a cafe and no one talked to me</p>'