Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coordinates from address.
#1
Would like to convert addresses to Longitude, Latitude so I can build a KML file to upload to google maps from a list of addresses.

Found this URL that uses JavaScript:
http://stevemorse.org/jcal/latlonbatch. ... on=forward

Thanks,
jimmy Vig
#2
The URL does it. Why use QM?
#3
I would like to avoid the step of having to go to the website and input the addresses.

Would like to just have address and then format the KML all with QM.

Having to use the website prevents the KML file creation from being automated.
#4
The javascript is big. Would be difficult to convert to QM.
You can try to automate the page, either in web browser or in web browser control.
Or find something else.
#5
Grr...Need to use google coordinates.

Site gets all bonkered on batch load for google and cannot be automated.
#6
I definitely have to have the google coordinates so the addresses display properly on a google map.

Cannot automate browser using QM because of security issues I haven't been able to figure out a way around.


Do you think the script could be modified just enough to use VbsFunc or is that what you meant too hard to convert to QM?

Just a thought.

Thanks,
Jimmy Vig
#7
javascript works only in web browser, or web browser control, or (only some simpler scripts) in HtmlDoc.
Maybe the script can be converted to QM, but it is very difficult or impossible.
Much easier would be to automate the web page, if possible.
I tried to run it in HtmlDoc. Did not work. Several errors, eg 'window' or some other object does not exist.
#8
I think I'm going to bail on that website.

Google has scripts to do this...I'll build a webpage myself that will grab the data straight from google that I can interface easily with.
#9
QM does not interface well with Java does it.

I've got a page that will generate the code based on a google GeoCode API javascript...but cannot grab that page with QM.

The java I wrote uses document.write ...so that's probably it. I'll play around...any advice to get a better output that QM can grab?

I was thinking maybe about writing a cookie and then reading that with QM...I don't know.

Thanks,
Jimmy Vig
#10
Quote:Cannot automate browser using QM because of security issues I haven't been able to figure out a way around.

The script uses Geocoding API V2.
http://code.google.com/apis/maps/docume ... index.html
There are usage limits. Maybe it is the reason why it does not work well.
Quote:Usage Limits

Use of the Google Geocoding V2 API is subject to a query limit of 15,000 geolocation requests per day. This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit or otherwise abuse the service, the Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Geocoding API may be blocked.

Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.

In V3 too.
http://code.google.com/apis/maps/docume ... geocoding/
Quote:Usage Limits

Use of the Google Geocoding API is subject to a query limit of 2,500 geolocation requests per day. (User of Google Maps API Premier may perform up to 100,000 requests per day.) This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit or otherwise abuse the service, the Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Geocoding API may be blocked.

Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.

I think it is easy to write macro in QM, without javascript, but it also may not work well because of these limits.
#11
Function GeocodeAddressToCoordinates
Code:
Copy      Help
;/
function $address double&lat double&lng [$region]

;Converts address (like "1600 Amphitheatre Parkway, Mountain View, CA", or "MyCity")
;into geographic coordinates (like latitude 37.423021 and longitude -122.083739).
;Uses <link "http://code.google.com/apis/maps/documentation/geocoding/">Google Geocoding</link>.
;Requires Internet connection.
;Error if failed.
;There are usage limits. Click the above link to read more. For example, the function may fail if called too frequently, or if called more than 2500 times/day.

;address - address.
;lat, lng, variables that receive latitude and longitude.
;region - region code. More info: click the above link.

;EXAMPLE
;double lat lng
;GeocodeAddressToCoordinates "London" lat lng
;out F"lat={lat}[]lng={lng}"


str s u a
a=address; a.escape(9)
u=F"http://maps.google.com/maps/api/geocode/xml?address={a}&sensor=false&region={region}"
IntGetFile u s
;out s

IXml x=CreateXml
x.FromString(s)
IXmlNode loc=x.Path("GeocodeResponse/result/geometry/location")
lat=val(loc.Child("lat").Value 2)
lng=val(loc.Child("lng").Value 2)

err+
,if(s.len) end F"Failed.  Server response:[]{s}"
,end _error

Similar function can be created to convert coordinates to address.
#12
Gintaras,

You are the best. Exactly what I was looking for.

Thanks bunches. I'll be sure to post my work for creating a google map when I get done. It's pretty neat stuff and very handy if you have maps on a website.

Thanks,
Jimmy Vig


Forum Jump:


Users browsing this thread: 1 Guest(s)