i'm a begener...i'm not sure of anything..need help to create java application as google maps

Discussion in 'Java' started by cristina, Nov 18, 2006.

  1. cristina

    cristina Guest

    hi everyone,
    i want to try to connect an application(only a desktop one) that exists
    with the maps by Developing Google Maps Application by Java(JSF) (&
    Java Script)..so i would like to improve the interface conecting in
    this case with a dinamic one.The instruments that i have to work on for
    the first time are:
    Eclipse,
    tomcat,
    sdk,
    xml,
    html..
    what can i do ?
    whow can i do to begin using the google maps API?can i?
    if anybody can please help me
    cristina, Nov 18, 2006
    #1
    1. Advertising

  2. cristina

    Simon Brooke Guest

    in message <>,
    cristina ('') wrote:

    > hi everyone,
    > i want to try to connect an application(only a desktop one) that exists
    > with the maps by Developing Google Maps Application by Java(JSF) (&
    > Java Script)..so i would like to improve the interface conecting in
    > this case with a dinamic one.The instruments that i have to work on for
    > the first time are:
    > Eclipse,
    > tomcat,
    > sdk,
    > xml,
    > html..
    > what can i do ?
    > whow can i do to begin using the google maps API?can i?
    > if anybody can please help me


    Googlemaps API is pretty easy and there are lots or ways to do it. The way
    I do it is to use an XSL transform on an XML stream generated by a servlet
    served by Tomcat to generate the HTML/JavaScript that is one way of
    driving Googlemaps.

    Like this, in fact:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
    <!-- -->
    <!-- google-maps-include.xsl -->
    <!-- -->
    <!-- Purpose: -->
    <!-- Include google maps into a news page. -->
    <!-- -->
    <!-- Author: Simon Brooke <> -->
    <!-- Created: 19th September 2006 -->
    <!-- Copyright: (c) 2006 Simon Brooke -->
    <!-- $Revision: 1.1.2.4 $ -->
    <!-- -->
    <!-- This program is free software; you can redistribute it -->
    <!-- and/or modify it under the terms of the GNU General -->
    <!-- Public License as published by the Free Software -->
    <!-- Foundation; either version 2 of the License, or (at your -->
    <!-- option) any later version. -->
    <!-- -->
    <!-- This program is distributed in the hope that it will be -->
    <!-- useful, but WITHOUT ANY WARRANTY; without even the -->
    <!-- implied warranty of MERCHANTABILITY or FITNESS FOR A -->
    <!-- PARTICULAR PURPOSE. See the GNU General Public License -->
    <!-- for more details. -->
    <!-- -->
    <!-- You should have received a copy of the GNU General Public -->
    <!-- License along with this program; if not, write to the Free -->
    <!-- Software Foundation, Inc., 59 Temple Place, Suite 330, -->
    <!-- Boston, MA 02111-1307 USA -->
    <!-- -->
    <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
    <xsl:variable name="googlemapskey"> @googlemapskey@ </xsl:variable>
    <xsl:template name="google-maps">
    <div class="contentmain"
    id="mapdiv" style="width: 800px; height: 600px; border:thin solid
    black;">
    <xsl:comment> probably best not to tag-minimise that DIV,
    either</xsl:comment>
    </div>

    <script type="text/javascript">
    <xsl:attribute
    name="src">http://maps.google.com/maps?file=api&amp;v=1&amp;key=<xsl:value-of
    select="normalize-space( $googlemapskey)"/></xsl:attribute>
    <xsl:comment> don't leave script tags empty! </xsl:comment>
    </script>
    <script
    type="text/javascript">
    if (GBrowserIsCompatible())
    {
    var map = new GMap(document.getElementById("mapdiv"));
    map.addControl( new GSmallMapControl());
    map.addControl( new GMapTypeControl());
    map.centerAndZoom(new GPoint( -4, 55), 8);

    <xsl:apply-templates xml:space="preserve" select="//story"/>

    }
    else
    {
    alert( "We're sorry, but your browser is not supported by Google
    Maps");
    }
    </script>
    </xsl:template>

    <!-- DO NOT reformat this. The interaction between JavaScript and XSL is
    horrible! -->
    <xsl:template match="story">
    <xsl:variable name="marker">marker<xsl:value-of
    select="position()"/></xsl:variable>
    <xsl:variable name="url">"/withmapsdemo/story/article_<xsl:value-of
    select='normalize-space(@article)'/>.html"</xsl:variable>
    <xsl:variable name="title">"<xsl:value-of
    select="normalize-space(title)"/>"</xsl:variable>
    <xsl:variable name="created">"<xsl:apply-templates
    select='created'/>"</xsl:variable>
    <xsl:apply-templates select="location"/>
    <xsl:text>

    </xsl:text>var <xsl:text> </xsl:text><xsl:value-of select="$marker"/>
    =
    createMarker(point, <xsl:value-of select="$url"/>,
    <xsl:value-of select='$title'/>, <xsl:value-of
    select="$created"/>);

    map.addOverlay(<xsl:value-of select="$marker"/>);<xsl:text>

    </xsl:text>
    </xsl:template>

    <xsl:template match="location">
    point = new GPoint( <xsl:value-of select="@longitude"/>,
    <xsl:value-of select="@latitude"/>);
    </xsl:template>

    </xsl:stylesheet>


    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    See one nuclear war, you've seen them all.
    Simon Brooke, Nov 18, 2006
    #2
    1. Advertising

  3. cristina

    Chris Uppal Guest

    Simon Brooke wrote:

    > Googlemaps API is pretty easy [...]


    > The way
    > I do it is to use an XSL transform on an XML stream generated by a servlet
    > served by Tomcat to generate the HTML/JavaScript [...]


    Hmm....

    -- chris
    Chris Uppal, Nov 19, 2006
    #3
  4. cristina

    cristina Guest

    thank you i'll try to do what you tell to me
    i'll write you the results,ok?

    thank you very much

    cristina
    Chris Uppal ha scritto:

    > Simon Brooke wrote:
    >
    > > Googlemaps API is pretty easy [...]

    >
    > > The way
    > > I do it is to use an XSL transform on an XML stream generated by a servlet
    > > served by Tomcat to generate the HTML/JavaScript [...]

    >
    > Hmm....
    >
    > -- chris
    cristina, Nov 19, 2006
    #4
  5. cristina

    cristina Guest

    Simone
    thank you i'll try to do what you tell to me
    i'll write you the results,ok?

    thank you very much

    cristina
    cristina, Nov 19, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    2,010
    Jeffrey Schwab
    Nov 28, 2005
  2. jobo
    Replies:
    2
    Views:
    432
  3. Replies:
    0
    Views:
    540
  4. Gilberto
    Replies:
    4
    Views:
    5,900
    Arne Vajhøj
    May 19, 2010
  5. Replies:
    0
    Views:
    475
Loading...

Share This Page