🪟 Windows TippsHow to install and use Open WebUI on Windows computer(16.09.2026 um 02:15 Uhr)
🕵️ Reverse EngineeringA IDA CLI tool: agent first & stateless & batch processing.(16.09.2026 um 04:34 Uhr)
🔧 Programmierunggame anak sd(16.09.2026 um 04:15 Uhr)
🪟 Windows TippsHow to install and use Open WebUI on Windows computer(16.09.2026 um 02:15 Uhr)
🕵️ Reverse EngineeringA IDA CLI tool: agent first & stateless & batch processing.(16.09.2026 um 04:34 Uhr)
🔧 Programmierunggame anak sd(16.09.2026 um 04:15 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 4 Min Lesezeit
0

Where in the World Am I?

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

There are so many fun things you can do with web services, and most of them are trivial to use in , and type:




CODE
http.get("https://api.ipify.org")






This should return an IP address, something like 66.212.203.27.



Now, to get information about that IP address, including the city it's in and an approximate latitude/longitude, we'll use a different web service:




CODE
http.get("http://ip-api.com/json/66.212.203.27")






You can replace the IP address above with whatever you got from the first query. The result will be a string of JSON code that contains your city, region, country, latitude, and longitude, along with the name of your internet service provider (ISP) and other details.



Putting this all together into a little program. Use edit to enter the code editor, then paste in the following:




CODE
import "json"
import "stringUtil"
clear

// What's my external IP address?
myIP = http.get("https://api.ipify.org")

// And where am I?
locJson = http.get("http://ip-api.com/json/" + myIP)
locInfo = json.parse(locJson)

pprint locInfo
print "You are in {city}, {region} ({country})".fill(locInfo)






Run this, and it should tell you where you are (along with all those other details). Neat, right?






Don't Tell Me, Show Me!



But we can make it more fun. Let's pinpoint you on a map of the Earth! edit your program again, delete the last two lines (pprint and print), and add in this additional code:




CODE
mapImage = file.loadImage("/sys/pics/earth_day.jpg")

// Find the pixel coordinates of our lat/long in this image
px = (locInfo.lon + 180) / 360 * mapImage.width
py = mapImage.height - (90 - locInfo.lat) / 180 * mapImage.height

// Draw a marker (using an offscreen PixelDisplay)
g = new PixelDisplay
g.clear color.black, mapImage.width, mapImage.height
g.drawImage mapImage
g.line 0, py, g.width, py, "#00FFFF88", 3
g.line px, 0, px, g.height, "#00FFFF88", 3
g.fillEllipse px-10, py-10, 20, 20, "#00FFFFFF"
g.drawEllipse px-15, py-15, 30, 30, "#00FFFFAA"
g.drawEllipse px-20, py-20, 40, 40, "#00FFFF88"
markedMap = g.getImage(0, 0, g.width, g.height)

// And draw the mapImage, fit to the screen!
scale = 960/mapImage.width
gfx.drawImage markedMap,
480 - mapImage.width*scale/2, 320 - mapImage.height*scale/2,
mapImage.width*scale, mapImage.height*scale

s = "{city}, {region}, ({countryCode})".fill(locInfo)
text.row = 2
text.column = 34 - s.len/2
print s






The result, if you happen to be my neighbor right now, should look like this:








Never Be Lost Again



The http module is an often-overlooked gem in the Mini Micro APIs. With one little call we can get our external IP address, and with a second little call, get all sorts of information about that, including the info we need to place ourselves on a map. We also looked at how you are able — nay, encouraged! — to steal from the demo code and make it your own.



What do you think of this? Let me know in the comments below!

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
European cloud watchdog slams Broadcom over VMware licensing practices, issues warnings about SAP
1 Quelle
Just in time for the Aussie summer, there's up to AU$300 off some of Dyson's popular purifying fans
1 Quelle
Amazon announces Prime Big Deal Days dates for 2026 in Australia — and the sale is earlier than expected
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Where in the World Am I?

Thematisch verwandte Begriffe: Where, World · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...