<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sinkro.net &#187; gmap</title>
	<atom:link href="http://www.sinkro.net/tag/gmap/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sinkro.net</link>
	<description>Software e dintorni. ... soprattutto dintorni ;-)</description>
	<lastBuildDate>Mon, 26 Sep 2011 01:42:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Attenti a Google map</title>
		<link>http://www.sinkro.net/2008/01/29/attenti-a-google-map/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=attenti-a-google-map</link>
		<comments>http://www.sinkro.net/2008/01/29/attenti-a-google-map/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 21:42:23 +0000</pubDate>
		<dc:creator>Massimiliano</dc:creator>
				<category><![CDATA[Articoli]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[gmap]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[street-view]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.sinkro.net/2008/01/29/attenti-a-google-map/</guid>
		<description><![CDATA[Credo conosciate già la vista stradale delle maps di google. Questo è un esempio di una strada a caso di Manhattan Purtroppo si sono verificati seri problemi di privacy. Altri articoli di interesse:Come aggiungere google maps in una pagina web Questa cosa e' facile facile e di sicuro effetto. La... Come utilizzare google da delphi [...]


Altri articoli di interesse:<ol><li><a href='http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/' rel='bookmark' title='Come aggiungere google maps in una pagina web'>Come aggiungere google maps in una pagina web</a> <small>Questa cosa e' facile facile e di sicuro effetto. La...</small></li>
<li><a href='http://www.sinkro.net/2006/07/23/usare-google-da-delphi/' rel='bookmark' title='Come utilizzare google da delphi'>Come utilizzare google da delphi</a> <small>Come primo passo Ã¨ necessario ottenere una google api key...</small></li>
<li><a href='http://www.sinkro.net/2009/01/31/questo-sito-potrebbe-arrecare-danni-al-tuo-computer/' rel='bookmark' title='Questo sito potrebbe arrecare danni al tuo computer'>Questo sito potrebbe arrecare danni al tuo computer</a> <small>Giornataccia a Mountain View. Secondo l'illustre parere di Google, oggi,...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Credo conosciate già la <em>vista stradale</em> delle maps di google.<br />
Questo è un <a href="http://maps.google.com/?ie=UTF8&amp;om=0&amp;layer=c&amp;cbll=40.757629,-73.99473&amp;cbp=1,476.6399999999999,,0,2.3341695595929517&amp;ll=40.758526,-73.994486&amp;spn=0.001938,0.004286&amp;z=18" target="_blank">esempio di una strada a caso di Manhattan</a></p>
<p>Purtroppo si sono verificati seri problemi di privacy. <img src='http://www.sinkro.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p><object width="425" height="355" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="wmode" value="transparent" /><param name="src" value="http://www.youtube.com/v/fPgV6-gnQaE&amp;rel=1" /><embed width="425" height="355" type="application/x-shockwave-flash" src="http://www.youtube.com/v/fPgV6-gnQaE&amp;rel=1" wmode="transparent" /></object></p>


<p>Altri articoli di interesse:<ol><li><a href='http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/' rel='bookmark' title='Come aggiungere google maps in una pagina web'>Come aggiungere google maps in una pagina web</a> <small>Questa cosa e' facile facile e di sicuro effetto. La...</small></li>
<li><a href='http://www.sinkro.net/2006/07/23/usare-google-da-delphi/' rel='bookmark' title='Come utilizzare google da delphi'>Come utilizzare google da delphi</a> <small>Come primo passo Ã¨ necessario ottenere una google api key...</small></li>
<li><a href='http://www.sinkro.net/2009/01/31/questo-sito-potrebbe-arrecare-danni-al-tuo-computer/' rel='bookmark' title='Questo sito potrebbe arrecare danni al tuo computer'>Questo sito potrebbe arrecare danni al tuo computer</a> <small>Giornataccia a Mountain View. Secondo l'illustre parere di Google, oggi,...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.sinkro.net/2008/01/29/attenti-a-google-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Come utilizzare google da delphi</title>
		<link>http://www.sinkro.net/2006/07/23/usare-google-da-delphi/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=usare-google-da-delphi</link>
		<comments>http://www.sinkro.net/2006/07/23/usare-google-da-delphi/#comments</comments>
		<pubDate>Sun, 23 Jul 2006 14:02:58 +0000</pubDate>
		<dc:creator>Massimiliano</dc:creator>
				<category><![CDATA[Codice]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[gmap]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false">http://www.sinkro.net/2006/07/23/usare-google-da-delphi/</guid>
		<description><![CDATA[Come primo passo Ã¨ necessario ottenere una google api key per poter utilizzare il WebService che Google ci mette a disposizione. La si puÃ² ottenere qui http://google.com/apis/. Una volta registrati si otterra' la key via email. In delphi 7 e successivi c'e' un utile strumento, wsdl importer che importa i wsdl e ci crea un [...]


Altri articoli di interesse:<ol><li><a href='http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/' rel='bookmark' title='Come aggiungere google maps in una pagina web'>Come aggiungere google maps in una pagina web</a> <small>Questa cosa e' facile facile e di sicuro effetto. La...</small></li>
<li><a href='http://www.sinkro.net/2004/02/03/inviare-fax-tramite-microsoft-faxserver-con-delphi/' rel='bookmark' title='Inviare fax tramite Microsoft FaxServer con delphi'>Inviare fax tramite Microsoft FaxServer con delphi</a> <small>uses ComObj; procedure TForm1.Button1Click&#40;Sender: TObject&#41;; var &nbsp; mFax,mFaxDoc: Variant; begin...</small></li>
<li><a href='http://www.sinkro.net/2008/01/29/attenti-a-google-map/' rel='bookmark' title='Attenti a Google map'>Attenti a Google map</a> <small>Credo conosciate già la vista stradale delle maps di google....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Come primo passo Ã¨ necessario ottenere una google api key per poter utilizzare il WebService che Google ci mette a disposizione.<br />
La si puÃ² ottenere qui <a href="http://www.google.com/apis/">http://google.com/apis/</a>.</p>
<p>Una volta registrati si otterra' la key via email.</p>
<p>In delphi 7 e successivi c'e' un utile strumento, wsdl importer che importa i wsdl e ci crea un file di interfaccia verso gli oggetti messi a disposizione dal webservice.</p>
<p>Usarlo Ã¨ piuttosto semplice:<br />
Entriamo in delphi e dal menu<br />
<em>file-&gt;new-&gt;other </em><br />
scegliamo<br />
<em>webservices-&gt;wsdl importer</em></p>
<p>Impostiamo l'url del wsdl in <em>http://api.google.com/GoogleSearch.wsdl</em></p>
<p>Clicchiamo Next e poi Finish.</p>
<p>Nell'editor si aprira' automaticamente il file GoogleSearch.pas.</p>
<p><span id="more-42"></span></p>
<p>In questo file troveremo, tra le altre cose, la definizione della classe <em>GoogleSearchPort</em></p>
<p>La definizione:</p>
<div class="syntax_hilite">
<div id="delphi-58">
<div class="delphi">GoogleSearchPort = <span style="color: #000000; font-weight: bold;">interface</span><span style="color: #66cc66;">&#40;</span>IInvokable<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'{0B396A82-A4DD-69A7-A771-6D80F8831A71}'</span><span style="color: #66cc66;">&#93;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> doGetCachedPage<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> key: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">const</span> url: <span style="color: #993333;">WideString</span><span style="color: #66cc66;">&#41;</span>: TByteDynArray; <span style="color: #000000; font-weight: bold;">stdcall</span>;<br />
<span style="color: #000000; font-weight: bold;">function</span> doSpellingSuggestion<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> key: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">const</span> phrase: <span style="color: #993333;">WideString</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">stdcall</span>;<br />
<span style="color: #000000; font-weight: bold;">function</span> doGoogleSearch<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> key: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">const</span> q: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">const</span> start: <span style="color: #993333;">Integer</span>; <span style="color: #000000; font-weight: bold;">const</span> maxResults: <span style="color: #993333;">Integer</span>; <span style="color: #000000; font-weight: bold;">const</span> filter: <span style="color: #993333;">Boolean</span>; <span style="color: #000000; font-weight: bold;">const</span> restrict: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">const</span> safeSearch: <span style="color: #993333;">Boolean</span>; <span style="color: #000000; font-weight: bold;">const</span> lr: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">const</span> ie: <span style="color: #993333;">WideString</span>; <span style="color: #000000; font-weight: bold;">const</span> oe: <span style="color: #993333;">WideString</span><br />
<span style="color: #66cc66;">&#41;</span>: GoogleSearchResult; <span style="color: #000000; font-weight: bold;">stdcall</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>;</div>
</div>
</div>
<p></p>
<p>Notare i tre metodi che Google ci mette a disposizione:</p>
<ul>
<li>doGetCachedPage</li>
<li>doSpellingSuggestion</li>
<li>doGoogleSearch</li>
</ul>
<p>Per testarli ho creato una form con un TEdit, un TMemo ed un TButton.<br />
APIKEY rappresenta la key che ci ha fornito Google per poter utilizzare il WebService.</p>
<p>Proviamo i metodi uno ad uno.</p>
<p><em><strong>doGetCachedPage</strong></em></p>
<p><em>doGetCachedPage</em> restituisce un TByteDynArray che troviamo nella unit types.</p>
<p>Quindi:</p>
<div class="syntax_hilite">
<div id="delphi-59">
<div class="delphi"><span style="color: #000000; font-weight: bold;">uses</span><br />
GoogleSearch<br />
, Types;</div>
</div>
</div>
<p></p>
<p>CiÃ² che segue Ã¨ come potrebbe essere una semplice funzione che usa il metodo <em>doGetCachedPage</em>:</p>
<div class="syntax_hilite">
<div id="delphi-60">
<div class="delphi"><span style="color: #000000; font-weight: bold;">var</span><br />
googleResult : TByteDynArray;<br />
google : GoogleSearchPort;<br />
mPage : <span style="color: #993333;">string</span>;<br />
i : <span style="color: #993333;">integer</span>;<br />
<span style="color: #000000; font-weight: bold;">begin</span><br />
google := GetGoogleSearchPort<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
googleResult := google.<span style="color: #006600;">doGetCachedPage</span><span style="color: #66cc66;">&#40;</span>APIKEY, edit1.<span style="color: #006600;">Text</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>mPage := <span style="color: #ff0000;">''</span>;<br />
<span style="color: #000000; font-weight: bold;">for</span> i := <span style="color: #cc66cc;">0</span> <span style="color: #000000; font-weight: bold;">to</span> <span style="color: #000066;">length</span><span style="color: #66cc66;">&#40;</span>googleResult<span style="color: #66cc66;">&#41;</span> - <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">do</span><br />
<span style="color: #000000; font-weight: bold;">begin</span><br />
mPage := mPage + <span style="color: #993333;">char</span><span style="color: #66cc66;">&#40;</span>googleResult<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>;<br />
Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Text</span> := mPage;<br />
<span style="color: #000000; font-weight: bold;">end</span>;</div>
</div>
</div>
<p></p>
<p><em><strong>doSpellingSuggestion</strong></em></p>
<p><em>doSpellingSuggestion</em> Ã¨ il metodo piÃ¹ semplice dato che restituisce una semplice <em>widestring</em>.</p>
<div class="syntax_hilite">
<div id="delphi-61">
<div class="delphi"><span style="color: #000000; font-weight: bold;">var</span><br />
google : GoogleSearchPort;<br />
mWord : <span style="color: #993333;">string</span>;<br />
<span style="color: #000000; font-weight: bold;">begin</span><br />
google := GetGoogleSearchPort<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
mWord := google.<span style="color: #006600;">doSpellingSuggestion</span><span style="color: #66cc66;">&#40;</span>APIKEY, edit1.<span style="color: #006600;">Text</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>Memo1.<span style="color: #006600;">Clear</span>;<br />
memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span>mWord<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>;</div>
</div>
</div>
<p></p>
<p><em><strong>doGoogleSearch</strong></em></p>
<p><em>doGoogleSearch</em> Ã¨ il metodo che ci permette di effettuare ricerche.</p>
<p>Richiede questi parametri:</p>
<ul>
<li><strong>key</strong> <em>Google Api key</em></li>
<li><strong>q</strong> <em>Il testo che stiamo cercando</em></li>
<li><strong>start</strong> <em>Da quale risultato partiamo</em></li>
<li><strong>maxResults</strong> <em>Quanti risultati volgiamo</em></li>
<li><strong>filter</strong> <em>Filtrare i risultati simili</em></li>
<li><strong>restrict</strong> <em>Restrizione di nazione o argomento</em></li>
<li><strong>safeSearch</strong> <em>filtro pornografia</em></li>
<li><strong>lr</strong> <em>restrizione di lingua</em></li>
<li><strong>ie</strong> <em>input encoding</em></li>
<li><strong>oe</strong> <em>output encoding</em></li>
</ul>
<p>nessuno dei quali e' opzionale.</p>
<p><em>doGoogleSearch</em> restituisce un oggetto di tipo <em>GoogleSearchResult</em> anch'esso definito nel wsdl e di conseguenza nel nostro GoogleSearch.pas generato automaticamente da <em>wsdl importer</em>.</p>
<p>Questa la dichiarazione:</p>
<div class="syntax_hilite">
<div id="delphi-62">
<div class="delphi">GoogleSearchResult = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TRemotable<span style="color: #66cc66;">&#41;</span><br />
...<br />
<span style="color: #000000; font-weight: bold;">published</span><br />
<span style="color: #000000; font-weight: bold;">property</span> documentFiltering: <span style="color: #993333;">Boolean</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> searchComments: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> estimatedTotalResultsCount: <span style="color: #993333;">Integer</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> estimateIsExact: <span style="color: #993333;">Boolean</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> resultElements: ResultElementArray;<br />
<span style="color: #000000; font-weight: bold;">property</span> searchQuery: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> startIndex: <span style="color: #993333;">Integer</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> endIndex: <span style="color: #993333;">Integer</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> searchTips: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> directoryCategories: DirectoryCategoryArray;<br />
<span style="color: #000000; font-weight: bold;">property</span> searchTime: <span style="color: #993333;">Double</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>;</div>
</div>
</div>
<p></p>
<p>Un altro oggetto importante Ã¨ <em>ResultElement</em>, ovvero ogni singolo risultato della ricerca. La dichiarazione:</p>
<div class="syntax_hilite">
<div id="delphi-63">
<div class="delphi">ResultElement = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TRemotable<span style="color: #66cc66;">&#41;</span><br />
...<br />
<span style="color: #000000; font-weight: bold;">published</span><br />
<span style="color: #000000; font-weight: bold;">property</span> summary: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> URL: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> snippet: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> title: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> cachedSize: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> relatedInformationPresent: <span style="color: #993333;">Boolean</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> hostName: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">property</span> directoryCategory: DirectoryCategory;<br />
<span style="color: #000000; font-weight: bold;">property</span> directoryTitle: <span style="color: #993333;">WideString</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>;</div>
</div>
</div>
<p></p>
<p>Vediamo un po' come possiamo implementare una semplice ricerca:</p>
<div class="syntax_hilite">
<div id="delphi-64">
<div class="delphi"><span style="color: #000000; font-weight: bold;">var</span><br />
googleResult : GoogleSearchResult;<br />
google : GoogleSearchPort;<br />
i : <span style="color: #993333;">integer</span>;<br />
<span style="color: #000000; font-weight: bold;">begin</span><br />
google := GetGoogleSearchPort<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
googleResult := google.<span style="color: #006600;">doGoogleSearch</span><span style="color: #66cc66;">&#40;</span><br />
APIKEY, Edit1.<span style="color: #006600;">Text</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #000000; font-weight: bold;">False</span>, <span style="color: #ff0000;">''</span>, <span style="color: #000000; font-weight: bold;">False</span>, <span style="color: #ff0000;">''</span>, <span style="color: #ff0000;">''</span>, <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>Memo1.<span style="color: #006600;">Clear</span>;</p>
<p>Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Trovati '</span> + <span style="color: #000066;">IntToStr</span><span style="color: #66cc66;">&#40;</span>googleResult.<span style="color: #006600;">estimatedTotalResultsCount</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">' risultati:'</span>;<br />
Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">for</span> i := <span style="color: #000066;">Low</span><span style="color: #66cc66;">&#40;</span>googleResult.<span style="color: #006600;">resultElements</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">to</span> <span style="color: #000066;">High</span><span style="color: #66cc66;">&#40;</span>googleResult.<span style="color: #006600;">resultElements</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">do</span><br />
<span style="color: #000000; font-weight: bold;">begin</span><br />
Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">IntToStr</span><span style="color: #66cc66;">&#40;</span>i + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span>googleResult.<span style="color: #006600;">resultElements</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">title</span><span style="color: #66cc66;">&#41;</span>;<br />
Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span>googleResult.<span style="color: #006600;">resultElements</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">URL</span><span style="color: #66cc66;">&#41;</span>;<br />
Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>;</div>
</div>
</div>
<p></p>
<p>Allego un progettino di esempio dove ho cercato di utilizzare tutte le proprietÃ  disponibili di <em>GoogleSearchResult</em> e di <em>ResultElement</em>:<br />
<a id="p43" href="http://www.sinkro.net/wp-content/uploads/2006/07/TestGoogleSearch.zip">TestGoogleSearch</a></p>


<p>Altri articoli di interesse:<ol><li><a href='http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/' rel='bookmark' title='Come aggiungere google maps in una pagina web'>Come aggiungere google maps in una pagina web</a> <small>Questa cosa e' facile facile e di sicuro effetto. La...</small></li>
<li><a href='http://www.sinkro.net/2004/02/03/inviare-fax-tramite-microsoft-faxserver-con-delphi/' rel='bookmark' title='Inviare fax tramite Microsoft FaxServer con delphi'>Inviare fax tramite Microsoft FaxServer con delphi</a> <small>uses ComObj; procedure TForm1.Button1Click&#40;Sender: TObject&#41;; var &nbsp; mFax,mFaxDoc: Variant; begin...</small></li>
<li><a href='http://www.sinkro.net/2008/01/29/attenti-a-google-map/' rel='bookmark' title='Attenti a Google map'>Attenti a Google map</a> <small>Credo conosciate già la vista stradale delle maps di google....</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.sinkro.net/2006/07/23/usare-google-da-delphi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Come aggiungere google maps in una pagina web</title>
		<link>http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=come-aggiungere-google-maps-in-una-pagina-web</link>
		<comments>http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/#comments</comments>
		<pubDate>Sat, 22 Jul 2006 21:58:49 +0000</pubDate>
		<dc:creator>Massimiliano</dc:creator>
				<category><![CDATA[Codice]]></category>
		<category><![CDATA[gmap]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[maps]]></category>

		<guid isPermaLink="false">http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/</guid>
		<description><![CDATA[Questa cosa e' facile facile e di sicuro effetto. La prima cosa da fare e' ottenere una google maps api key per poter usare google map sul proprio sito. La si può ottenere qui. Nel momento in cui google ci fornisce la google maps api key, ci mostra il codice per un utilizzo di base. [...]


Altri articoli di interesse:<ol><li><a href='http://www.sinkro.net/2008/01/29/attenti-a-google-map/' rel='bookmark' title='Attenti a Google map'>Attenti a Google map</a> <small>Credo conosciate già la vista stradale delle maps di google....</small></li>
<li><a href='http://www.sinkro.net/2006/07/23/usare-google-da-delphi/' rel='bookmark' title='Come utilizzare google da delphi'>Come utilizzare google da delphi</a> <small>Come primo passo Ã¨ necessario ottenere una google api key...</small></li>
<li><a href='http://www.sinkro.net/2009/01/31/questo-sito-potrebbe-arrecare-danni-al-tuo-computer/' rel='bookmark' title='Questo sito potrebbe arrecare danni al tuo computer'>Questo sito potrebbe arrecare danni al tuo computer</a> <small>Giornataccia a Mountain View. Secondo l'illustre parere di Google, oggi,...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Questa cosa e' facile facile e di sicuro effetto.</p>
<p>La prima cosa da fare e' ottenere una google maps api key per poter usare google map sul proprio sito. La si può ottenere <a target="_blank" href="http://www.google.it/apis/maps/">qui</a>.</p>
<p>Nel momento in cui google ci fornisce la google maps api key, ci mostra  il codice per un utilizzo di base. Lo riporto qua commentandolo giusto per capire cosa andremo a fare.<br />
Prima di tutto importiamo le funzioni da google. Questa riga contiene la nostra key e funzionerà  solamente con il dominio per il quale abbiamo ottenuto la key.</p>
<div class="syntax_hilite">
<div id="javascript-91">
<div class="javascript">&lt;script <br />
&nbsp; &nbsp; src=<span style="color: #3366CC;">"http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=ABQIAAAAZlIgpyuvZY8pz7QUTVaVVhSLYOoNmsRXdvX4J4J6dbd5jt8ogRQlK9W1V6_wnfq3Ze9Lebaq5HYVvA"</span><br />
&nbsp; &nbsp; type=<span style="color: #3366CC;">"text/javascript"</span>&gt;<br />
&lt;/script&gt;</div>
</div>
</div>
<p>
Ora definiamo la funzione che caricherà  la mappa:</p>
<p><span id="more-39"></span></p>
<div class="syntax_hilite">
<div id="javascript-92">
<div class="javascript">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//&lt;![CDATA[</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> load<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>GBrowserIsCompatible<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> map = <span style="color: #003366; font-weight: bold;">new</span> GMap2<span style="color: #66cc66;">&#40;</span>document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"map"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;map.<span style="color: #006600;">setCenter</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> GLatLng<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">37</span>.<span style="color: #CC0000;">4419</span>, -<span style="color: #CC0000;">122</span>.<span style="color: #CC0000;">1419</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #CC0000;">13</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//]]&gt;</span><br />
&lt;/script&gt;</div>
</div>
</div>
<p></p>
<p>Queste coordinate pero' non fanno per noi, quindi andiamo su <a target="_blank" href="http://maps.google.com/maps?q=piazza%20del%20popolo%20cesena,%20it">maps.google.com</a> e cerchiamo l'indirizzo di cui vogliamo mostrare la mappe.</p>
<p>Una volta centrata la mappa possiamo ottenere le coordinate cliccando prima su <em>"satellite"</em> poi su <em>"Collegamento a questa pagina"</em> in alto a destra. Fatto questo troveremo le coordinate che cercavamo nell'url.</p>
<p>Nel mio caso: <em>44.137362,12.241838</em></p>
<p>Bene ora la nostra funzione diventerà :</p>
<div class="syntax_hilite">
<div id="javascript-93">
<div class="javascript">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//&lt;![CDATA[</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> load<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>GBrowserIsCompatible<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> map = <span style="color: #003366; font-weight: bold;">new</span> GMap2<span style="color: #66cc66;">&#40;</span>document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"map"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; point = <span style="color: #003366; font-weight: bold;">new</span> GLatLng<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">44</span>.<span style="color: #CC0000;">137362</span>, <span style="color: #CC0000;">12</span>.<span style="color: #CC0000;">241838</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.<span style="color: #006600;">setCenter</span><span style="color: #66cc66;">&#40;</span>point, <span style="color: #CC0000;">23</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//]]&gt;</span><br />
&lt;/script&gt;</div>
</div>
</div>
<p></p>
<p>Però manca ancora qualche cosina:</p>
<ul>
<li>visualizzare i controlli per lo zoom e lo spostamento</li>
<li>visualizzazione ibrida cioè la mappa sovrapposta alle immagini da satellite</li>
<li>zoomare con un doppio click</li>
<li>visualizzare una finestra di informazione</li>
</ul>
<p>Unisco il tutto nella funzione definitiva:</p>
<div class="syntax_hilite">
<div id="javascript-94">
<div class="javascript">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//&lt;![CDATA[</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> WINDOW_HTML = <span style="color: #3366CC;">'&lt;div style=&quot;width: 210px; padding-right: 10px&quot;&gt;&lt;b&gt;Io sono qui!&lt;br/&gt;Tu dove sei?&lt;/div&gt;'</span>;<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> load<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>GBrowserIsCompatible<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> map = <span style="color: #003366; font-weight: bold;">new</span> GMap2<span style="color: #66cc66;">&#40;</span>document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"map"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//definisco la mia posizione</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; point = <span style="color: #003366; font-weight: bold;">new</span> GLatLng<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">44</span>.<span style="color: #CC0000;">137362</span>, <span style="color: #CC0000;">12</span>.<span style="color: #CC0000;">241838</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//definisco un marcatore</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marker = <span style="color: #003366; font-weight: bold;">new</span> GMarker<span style="color: #66cc66;">&#40;</span>point<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Aggiungo i controlli zoom e pan</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.<span style="color: #006600;">addControl</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> GSmallMapControl<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Aggiungo la selezione del tipo di mappa</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.<span style="color: #006600;">addControl</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> GMapTypeControl<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Imposto il centro della mappa</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.<span style="color: #006600;">setCenter</span><span style="color: #66cc66;">&#40;</span>point, <span style="color: #CC0000;">18</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Abilito lo zoom con doppioclick</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.<span style="color: #006600;">enableDoubleClickZoom</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Mostro il marcatore</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.<span style="color: #006600;">addOverlay</span><span style="color: #66cc66;">&#40;</span>marker<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Definisco il tipo di mappa (Ibrido)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.<span style="color: #006600;">setMapType</span><span style="color: #66cc66;">&#40;</span>G_HYBRID_MAP<span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Mostro la finestra di informazioni</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; marker.<span style="color: #006600;">openInfoWindowHtml</span><span style="color: #66cc66;">&#40;</span>WINDOW_HTML<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></p>
<p>&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//]]&gt;</span><br />
&lt;/script&gt;</div>
</div>
</div>
<p></p>
<p>Tutto qua, e questo e' il risultato: <a target="_blank" href="http://www.sinkro.net/wp-content/uploads/2006/07/gmap.html">Esempio google map</a></p>
<p>La <a target="_blank" href="http://www.google.it/apis/maps/documentation/">documentazione</a> è piuttosto chiara e si possono esplorare diverse funzionalità .</p>
<p>Può capitare che il cliente abbia due o piu' domini che puntano allo stesso sito, mentre la google map key è relativa ad un singolo dominio.</p>
<p>il trucco è semplice e ringrazio Laura che pur non conoscendo nulla di Javascript ha avuto l'illuminazione mentre io seguivo strade buie <img src='http://www.sinkro.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="syntax_hilite">
<div id="javascript-95">
<div class="javascript"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>location.<span style="color: #006600;">hostname</span> == <span style="color: #3366CC;">"www.tuosito.com"</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; location.<span style="color: #006600;">hostname</span> = <span style="color: #3366CC;">"www.tuosito.it"</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Semplice e funzionale, brava Laura! <img src='http://www.sinkro.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>


<p>Altri articoli di interesse:<ol><li><a href='http://www.sinkro.net/2008/01/29/attenti-a-google-map/' rel='bookmark' title='Attenti a Google map'>Attenti a Google map</a> <small>Credo conosciate già la vista stradale delle maps di google....</small></li>
<li><a href='http://www.sinkro.net/2006/07/23/usare-google-da-delphi/' rel='bookmark' title='Come utilizzare google da delphi'>Come utilizzare google da delphi</a> <small>Come primo passo Ã¨ necessario ottenere una google api key...</small></li>
<li><a href='http://www.sinkro.net/2009/01/31/questo-sito-potrebbe-arrecare-danni-al-tuo-computer/' rel='bookmark' title='Questo sito potrebbe arrecare danni al tuo computer'>Questo sito potrebbe arrecare danni al tuo computer</a> <small>Giornataccia a Mountain View. Secondo l'illustre parere di Google, oggi,...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.sinkro.net/2006/07/22/come-aggiungere-google-maps-in-una-pagina-web/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

