How to code a map system into a web app?

Red Squirrel

No Lifer
May 24, 2003
70,746
13,855
126
www.anyf.ca
I'm writing a web app for my company, basically it's to input all of our buildings and I'd also like to add a longitude latitude for each site, and have it show up on a map. Something like Google Maps. Is there an API out there I can use that has the maps already pre made? I believe Google Maps has an API but don't think it's open source. This is a program that will most likely be released under GPL so I need to be able to use an API that is also GPL or equivalent. Any such thing?

Worse case scenario, anyone know how I can generate a google map's link with longitude and latitude? Instead of embedding it in my app I can also just have a link to google maps... I mean, automate it, don't want to actually have to physically go find it then copy and paste the link for each one.
 

Red Squirrel

No Lifer
May 24, 2003
70,746
13,855
126
www.anyf.ca
That looks pretty neat, I'll have to check that out.

My other option is that instead of embedding the map I might actually just have a link that opens it on google maps, is there a way to do that? Basically feed the coords in a url and it goes to the right spot?
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,729
4,698
75
My other option is that instead of embedding the map I might actually just have a link that opens it on google maps, is there a way to do that? Basically feed the coords in a url and it goes to the right spot?

That's quite a bit easier. Take a look at how Wikipedia's Toolserver does it.

Edit: I finally found OpenStreetMap's embedding page.

Edit2: Best of both worlds! OpenStreetMap has an Export button. Click it and you can get HTML to place in your site, like this:
Code:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.openstreetmap.org/export/embed.html?bbox=-105.4238,39.9,-105.1611,40.1385&amp;layer=mapnik" style="border: 1px solid black"></iframe><br /><small><a href="http://www.openstreetmap.org/?lat=40.01925&amp;lon=-105.29245&amp;zoom=11&amp;layers=M">View Larger Map</a></small>
 
Last edited: