Skip to content

Extract data from GoogleMaps and us it in the project

Hi,
I'm working to add new engine to GSA, and I need to get coordinates from Goole Maps

How to get Location Lat and Lat and put them two different variables? 

I have something like this

[Google_cor]
type=extract
front="location" : {
back=}

Help me please

Comments

  • SvenSven www.GSA-Online.de
    [latitude]
    type=extract
    url=https://maps.googleapis.com/maps/api/geocode/json?address=Chicago,USA
    front1="location"
    front2="lat" :
    back=,|}

    [longitude]
    type=extract
    url=https://maps.googleapis.com/maps/api/geocode/json?address=Chicago,USA
    front1="location"
    front2="lng" :
    back=,|}
  • AdamSAdamS Australia
    Thx Sven,
    With your example I need to get content 2 times.
    What if I need for example 30 variables?
  • SvenSven www.GSA-Online.de

    you can save that whole content in one variable and use it with "input=%url_content%" where


    [url_content]
    type=extract
    url=https://maps.googleapis.com/maps/api/geocode/json?address=Chicago,USA
    front="results" : [
    back=status" : "OK



    [latitude]
    type=extract
    input=%url_content%
    front1="location"
    front2="lat" :
    back=,|}

    [longitude]
    type=extract
    input=%url_content%
    front1="location"
    front2="lng" :
    back=,|}
  • AdamSAdamS Australia
    you are legend - thx
  • AdamSAdamS Australia
    Lats question ;)

    I have something like this
    [google_state]
    type=extract
    input=%google_cor%
    front1="address_components"
    front2=},{
    front3="long_name" : "
    back1=",
    back2=},{

    but not working
  • SvenSven www.GSA-Online.de
    front3 is wrong...the " around it get cut when reading that file ...either you remove " from front or put that all again in "". ...correct would be... front3=long_name" : "
  • AdamSAdamS Australia
    no, not working
    this is what I get " : [ "long_name" : "Brisbane
  • SvenSven www.GSA-Online.de

    it takes the first address_component data...always the first match that you define with front/back.

    In the end it's simple. You just load this into notepad and do the search with front1 and continue on first appering with front2. Spaces and new line chars are cut from the result.

  • AdamSAdamS Australia
    edited September 2015
    Maybe this is a stupid question, but how can I test it?

    At the moment I have to run a project in debug mode to check only one thing 
  • SvenSven www.GSA-Online.de
    hmm well right now there is no other solution than running in debug mode.
  • AdamSAdamS Australia
    edited September 2015
    Hi,
    this is quite similar, so I will not open new topic

    I have something like this
    {"_3003946":"Old Toongabbie, NSW","_3003954":"Toongabbie, NSW","_3001191":"Toongabbie, VIC"}

    and I need to extract the number (3003954) for Toongabbie, NSW.
    The problem is, the order get changed sometimes by itself
    {"_3003954":"Toongabbie, NSW","_3001191":"Toongabbie, VIC","_3003946":"Old Toongabbie, NSW"}

  • SvenSven www.GSA-Online.de
    edited September 2015

    Hmm thats hard as the unique identifier comes after the stuff you want to extract. 



    [part1]
    type=extract
    front={"
    back=",|"}
    must have=Toongabbie, NSW
    default=%part2%

    [part2]
    type=extract
    front={"
    front2=,"
    back=",|"}
    must have=Toongabbie, NSW
    default=%part3%

    [part3]
    type=extract
    front={"
    front2=,"
    front3=,"
    back=",|"}
    must have=Toongabbie, NSW
    ;default=%part4% <<< define it if required...

    ....

    [var]
    type=extract
    input=%part1%
    front=_
    back="

    Even though you are using %part1% as input, SER will fill it with content of part2 or part3 if not matching.

  • AdamSAdamS Australia
    I think it doesn't work
    You exrtact number only, and you have something like 
    must have=Toongabbie, NSW
  • SvenSven www.GSA-Online.de
    You have to use %var% not %part%....That %part% is just a helping variable.
  • AdamSAdamS Australia
    edited September 2015
    aaa, ok - I'll try
  • SvenSven www.GSA-Online.de
    when you want to get your number, you need to use %var% in my sample. Not %partX%. So the "must have" is correct in the [partX] section.
Sign In or Register to comment.