Slippy Map Implementation: Zoomable map of the world with OpenStreetMap

Hello everyone!
Here is a little implementation of a slippy map (aka. a map where you zoom and pan around) that made using my touch library and data from openstreetmap.org. I’ve used OpenStreetMap because I found that it was the easiest tile provider out there (it’s free, easy to use and setup and doesn’t require an API key). However, feel free to customize it with other maps if you want!
By the way, I might improve my code (by adding helper functions to convert from lat/long to map coordinates or geolocation,…) or make it an easy to use library (like Leaflet), especially if I see that there is interest.
Have fun!

@dadaroulin Nice program. Add an option that zooms in a little each time you touch a map location.

@dadaroulin - yeah it is neat. Expanding on @dave1707 's suggestion, make the location selected with the touch the centre of the screen. Long touch for zoom. So short touch centre long touch zoom

@dadaroulin i don’t see your code? Would appreciate to see it if still available…Thanks.

@Bri_G By any chance do you have a copy of this slippy map iimplementation?

@piinthesky - no - I don’t remember seeing a post with the code attached. Sorry. I’ll check through my downloads just in case I have.

@piinthesky - Hey! Apparently the code disappeared from the forum from some reason…
Anyway, I think I found the original project in my documents:
Map.zip (3.2 KB)
I’ve just tested it, it seems like it still works!

@dadaroulin it works really well, wonderful! Exactly what i was looking for. Many thanks.

Strange… when connected to wifi all works, but when connected by 4G it gives error: internet is offline, even though the internet connection is good. Do you see that? Any ideas how to fix?

That’s weird, I never had this problem happened to me. Could you send me the actual error message?

the exact messsge is;

Did not get tile: 0 0 0.0

Error: The Internet connection appears to be offline.

Ahhh, my fault…in the settings for data roaming i had Codea disabled. Once i allowed that it works!

@dadaroulin can I put your project up on WebDepo?

Also, if you want to try something fun, you could use my CubeMapSphere project (available on WebRepo itself) to see if you could make a globe that you could use to zoom all the way in to anywhere.

@UberGoober Of course you can upload it, that would be great! I’ve actually discovered a bug in the zooming logic where the map would drift if you tried to zoom past the minimum and maximum zoom, so here’s an updated version where this is fixed:

Map.zip (308.7 KB)

I might look into that CubeMapSphere project later on, although I guess i would need to change the projection logic or use some special tiles to make it work. But that would be a lot fun for sure!

2 Likes