Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Best way to enrich data with the Google MAPS API

  1. #1
    Join Date
    Jun 2013
    Posts
    2

    Default Best way to enrich data with the Google MAPS API

    Hello,

    I have to add standard locality/country/etc information derived from an address or lat/long. data in a database table.

    As far as I see I cannot use the appropriate Google JavaScript Library with the Script-Module, as it won't work there (Javascript error: ReferenceError: "google" is not defined, after loading https://maps.googleapis.com/maps/api/js?sensor=false)
    An alternative would be to query the Server via the HTTP-Client, and parse it with the JSON module, but right now I most probably fail to add the needed parameters to the HTTP-Client module: the Process stops in this module without an explanation.

    Is this the right way to follow, or are there better solutions?

    Regards,
    Rudi

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    The JavaScript engine used in Kettle is Rhino, essentially an engine for server side scripting.
    The Maps JavaScript API expects a browser environment.
    So using the Maps Webservice seems to be the best way to go.
    Let's find out why the HTTP Client keeps failing you.
    What helpful information can you provide?
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Jun 2013
    Posts
    2

    Default

    > The JavaScript engine used in Kettle is Rhino, essentially an engine for server side scripting.

    Thanks for this info. I was going to look where the JS library functions are documented, this info makes my task easier.
    Are there any additional libraries/functions provided by Kettle?

    > Let's find out why the HTTP Client keeps failing you.

    I entered the URL (http://maps.googleapis.com/maps/api/geocode/json) on the General page of the HTML-Client detail window, and the parameters (address=XXX, sensor=false) on the second (Fields) page. The process stopped in this step (red line), and I found no detailed error message.

    In the meantime I reverted to a workaround: in a Javascript step before the HTML-Client step I compute the complete URL (http://maps.googleapis.com/maps/api/...X&sensor=false), which works as expected. The answer is parsed by the JSON-Input module (I had luck in specifying the parameters there, as I did not found a documentation on this module). The result is filtered by row-filters, and fed into update steps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.