This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How do I embed a map in a CMS-based web site?

0

I recently wrote an extension* for PunBB as I wanted an alternative option to Google Maps and very much liked the feel of OSM.

However when I create a post A with an embeded map section XYZ with fixed longitude X1 and latitude Y2 I encounter unexpected behaviour after visiting OTHERS, ADDITIONAL posts with other map sections with lon:X2 lat:Y3. The unexpected behaviour: The map shows whatever map section I was last browsing. Why?

Thanks for any ideas... * (http://punbb.informer.com/forums/topic/24786/extension-open-street-map/)

asked 05 Jan '12, 08:22

KeyDog's gravatar image

KeyDog
1112
accept rate: 0%

edited 05 Jan '12, 09:39

Jonathan%20Bennett's gravatar image

Jonathan Ben...
8.3k1785108


2 Answers:

2

Your extension doesn't embed a map - it embeds the whole of openstreetmap.org in an iframe. This isn't the correct way to include an OpenStreetMap-based map on a web page. Please use the Export feature or include your own slippy map using OpenLayers to display a map.

answered 05 Jan '12, 09:36

Jonathan%20Bennett's gravatar image

Jonathan Ben...
8.3k1785108
accept rate: 18%

0

This is a good starting point for the question you are asking. Several examples already out there...

https://wiki.openstreetmap.org/wiki/Deploying_your_own_Slippy_Map

answered 12 Jan '12, 02:59

Andy%20F's gravatar image

Andy F
46115
accept rate: 0%

Source code available on GitHub .