Hi there,
I'm a new zoho user and I'm having some problems trying to work out how to get my address from zoho creator into google msps. My addresses are formatted like, field 1: house number; field 2: street; field 3: surburb
I have looked through the forums and this looks like the way to do it, but where do I enter this code? do I have to create a new HTML view? if someone could please walk me through how to use the code, that would be much appreicated.
------------
The script uses the PostUrl function to send header parameters and write CSV Data in the request body.
Function for generating
authoization header
- string googlemap.getGoogleAuthToken(string email, string passwd, string GoogleService)
- {
- accountType = "HOSTED_OR_GOOGLE";
- url = "https://www.google.com/accounts/ClientLogin?accountType=" + accountType + "&Email=" + email + "&Passwd=" + passwd + "&service=" + input.GoogleService; // Check GDATA API for service codes
- response = getUrl(url);
- authToken = response.getSuffix("Auth=").trim(); // Store this Authorization for subsequent request
- return authToken;
- }
Function to retrive the latitude and langitude for address (
Geocoding requests).
- map googlemap.getLatitudeAndLangitudeMap(string address)
- {
- latandlngXml = getUrl("http://maps.google.com/maps/api/geocode/xml?address=" + input.address + "&sensor=true"); // Retriving xml containing latitude and langitude xml
- latitude = latandlngXml.executeXPath("/GeocodeResponse/result/geometry/location/lat/text()");
- langitude = latandlngXml.executeXPath("/GeocodeResponse/result/geometry/location/lng/text()");
- return { "latitude" : latitude, "langitude" : langitude};
- }
Function for adding PlaceMarks to GoogleMap.
- void googlemap.createMapAndAddPlaceMark(string mapName, string placeTitle, string address)
- {
- GoogleAuthToken = thisapp.googlemap.getGoogleAuthToken("xxx@gmail.com", "yyy", "local");
- //HeaderParams included
- headerMap = { "Authorization" : "GoogleLogin auth=\"" + GoogleAuthToken + "\"", "Content-Type" : "text/csv", "Slug" : input.mapName };
- latAndLanMap = thisapp.googlemap.getLatitudeAndLangitudeMap(address);
- latitude = latAndLanMap.get("latitude");
- langitude = latAndLanMap.get("langitude");
- //CSVMap Data Generating
- title = input.placeTitle;
- placeDesc = (input.address).replaceAll(","," ");
- csvMapData = "name,latitude,longitude,description\n" + title + "," + latitude + "," + langitude + "," + placeDesc;
- //Adding GoogleMap into MyMaps to the AuthenticatedUser.
- result = postUrl("http://maps.google.com/maps/feeds/maps/default/full", csvMapData, headerMap,false);
- info result.get("responseText");
- info result.get("responseCode");
- }
==================
Thanks