/    Sign up×
Community /Pin to ProfileBookmark

Google Geocoding

Hi there,

I know too little of JavaScript to get the Google Maps API working.
I hope someone can help me out!

My goal is to display an address.
In the example on google, you can input it through a form:
[url]http://code.google.com/apis/maps/doc…ng-simple.html[/url]

I would like the map to show the location+marker when I open the page, not after clicking a submit button.
However, I only want an address in my html. I want the API to convert it in a LatLng format.

Hopefully, someone can take the time to look at it.
It’s all in the source code of the page mentioned above, I believe.

Thanks!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@wbportNov 23.2010 — Hi there,

I know too little of JavaScript to get the Google Maps API working.

I hope someone can help me out!

My goal is to display an address.

In the example on google, you can input it through a form:

(url)http://code.google.com/apis/maps/doc...ng-simple.html(/url)[/QUOTE]

I could not reach your example. Try (url=http://www etc, full name.html)What you want to show(/url). Quote this message and look at the bottom of it for an example.

I would like the map to show the location+marker when I open the page, not after clicking a submit button.

However, I only want an address in my html. I want the API to convert it in a LatLng format.

Hopefully, someone can take the time to look at it.

It's all in the source code of the page mentioned above, I believe.
[/QUOTE]

There is a google forum to discuss these types of questions, but I never got that deep. This is some code to reference a working page:
[CODE]function doMap() {
var newlink;
if (lat1.NaN || lon1.NaN || lat2.NaN || lon2.NaN) {
alert ("Run distance function first");
return 1; }
newlink = "http://www.movable-type.co.uk/scripts/latlong-map.html?lat1=" + lat1 + "&long1=" + lon1 + "&lat2="
+ lat2 + "&long2=" + lon2 ;
self.location.href = newlink;
}
[/CODE]

It is from my gps page.
Copy linkTweet thisAlerts:
@jorikkoppertauthorNov 23.2010 — OK, a retry for the Simple Geocoding example.

If you look at the source, you see two functions:

initialize() & codeAddress()

In the first, you have to enter the LatLng value, but in the second function that value is retrieved by [CODE]map.setCenter(results[0].geometry.location);[/CODE]
That's what I make of it. Any way of getting that value on the page load and using it to generate the map?
×

Success!

Help @jorikkoppert spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...