TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 25, 2024, 09:44:08 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,173
  • Total Topics: 21,219
  • Online today: 319
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online

Google Maps

Started by Wantonio, July 25, 2006, 01:40:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Wantonio

Hi!
Here is the code for a small Google-Maps-Block (javascript/html):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=HERE-YOUR-KEY"
            type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallZoomControl());
        map.setCenter(new GLatLng(50.8,10.0), 5);
      }
    }
    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
  <div id="map" style="overflow:hidden; height: 280px"></div>
</html>


First you have to sign up with your URL at google.
Here is the link: http://www.google.com/apis/maps/signup.html
After that, you have to replace the part above with: "HERE-YOUR-KEY" with your own key...
That's all ;)

For your own controls look at the API on the google-maps sites.
Edit the coords and the zoom in this line: map.setCenter(new GLatLng(50.8,10.0), 5);

Have fun
Greetz Wan

//EDIT: If you want to see how this works in action have a look at www.kulturwochenende.com/forum but this site is under construction..

Pic:

akulion

nice one ill try using it later with my membermap mod :D

RoarinRow

That's cool! A map in a small window like that.

For our site we use Frappr - http://www.frappr.com/avalanchestyle

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Max


akulion

Added to block code index under "G" as "Google map block"

crewzer

Hi,

Looks great on your site but I have a silly question.
When I put your code into a block (html type) content area and display the block I get some of the text from the block. No map!

Do you put the code in a separate file and call that file from the block?
If so, what code do you use to call it?

Thanks,
crewzer

IchBin

Put it in a scriptbox instead.

crewzer

Ahhh... works!
Huge thanks.

jessicac

anyway to put this in an article?

hsdk

I have a google map in a php article, i also have  a data.xml wich the map reads markers from and shows them on the map.

Could someone with the right skills create a form witch sends new markers to the xml file. That way users could add markers to my map :)

The xml file looks like this:


<markers>
 
<marker lat="65.605349" lng="9.459274"> Text / URL </marker>
   
<marker lat="67.605349" lng="6.459274"> Text / URL </marker>
   
<marker lat="69.605349" lng="8.459274"> Text / URL </marker>
   
<marker lat="61.605349" lng="7.459274"> Text / URL </marker>
   
</markers>


I have my map working in the article, and my markers showing up. But i would like this form below my article to adde more markers :)


hope someone will help!