Mapping locations (GET request, String Manipulation, Regex Extractor)

Hello together,

I have set up the following Workflow with the goal to map locations:
image

In the Table Creator I wrote down a couple of cities as examples and the workflow runs through.
My final list has about 2.800 cities - do you have any experience until how many given locations the GET request runs?
I tried it with all and it stopped really quick (error).

In the end, I want to visualize the map with the OSM Map View Node and for that I am trying to extract the latitude and longtitude.

I tried it 2 ways:

  1. String Manipulation as shown in this video (Data Access with KNIME: Sending a GET Request to a REST service - YouTube)
    I couldn´t figure out, how I have to configure it to the toDouble(). Can you help me?

  2. Regex Extractor


    Here is the configuration of the Regex Extractor which is not working.
    When I put in: \b[“location” : {“lat” : ]+[0-9]{2,}+.+[0-p{15}]\b
    it has an output, but the results are not always the right ones - sometimes it catches the longitute instead. What am I missing to catch both?

I am happy about answers to all the questions or some of them - thank you!

Best
Margarethe

Do you want to extracdt lat and long?
If so you should be able to do it directly with JSON Path node instead of regex
br

Thanks for the quick answer and the suggestion.

Just tried it, but I don´t get an output.
Here ist my Json body:
image
image

My configuration was: $.results.geometry.location.lat[0]. What am I doing wrong?

Have a look at this example workflow provided by KNIME.

Full location: knime://EXAMPLES/Users/knime/Examples/03_Visualization/04_Geolocation/06_Google_Geocode_API-OSM-text_file

Back-up:

This should help you further with the correct JSON Path. If this doesn’t solve the problem, please upload your JSON body so other people can work with it. It’s a bit too much to type over from a screenshot.

2 Likes

Thank you @ArjenEX for leading me to this example workflow!

I could do the configuration until the OSM Map View and it looks good in my workflow.

I executed the OSM Map and my points are somewhere in Africa, but should be all in Germany. The Latitudes and Longtitudes should be fine (checked them manually on Google Maps).

Looking at the result of the example workflow if realized that it doens´t show any points on the map. Also the result table before (String Manipulations and Column Filter of the Metanode) don´t show any result.

Do you have an idea what could be wrong?

Did you map latitude and longitude correclty in OSM Map View?
br

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.