How to parse a URL to extract longitude and latitude values only of a map

How would I go about parsing a URL to extract long. and lat. values for a map. So for this example:

https:// media.rightmove.co.uk/map/_generate?width=761&height=347&zoomLevel=15&latitude=51.068509&longitude=-1.800635&signature=_JzeV8INWTON89M3-vFPvRUP-Pc=

I want to extract this two values separately for me to use in another module:

51.068509
-1.80063

Use the “Match Pattern” module with a regex:

&(?:latitude=(?<lat>-?(?:\d+\.)?\d+)|longitude=(?<lng>-?(?:\d+\.)?\d+))

Output:

this is great, thank you @samliew
I did what you told me to do but it doesn’t seem like I’m getting any output


Another problem I’m running into now is that, when I click run once for the whole scenario, only the first 2 modules are working, any reason for this?

Your pattern is incorrect, please compare your screenshot with mine.

In the Text Parser module, if you have the option “Continue the execution of the route even if the module finds no matches” set to False, then it will NOT continue if no matches were found. Since no matches are being found, the Scenario does not continue.

3 Likes

Apologies you are right, I have amended that and now I have another problem (sorry about this back and forth) @samliew

My next module, which is http using the lat and long values, it is now performing two seperate operations, its not meant to do that but it should only perform one. But basically what it’s doing is splitting the lat and long values into two seperate operations thereby leading to invalid request as output



hey @samliew would really appreciate your help with the above, my http module is doing two operations instead it should be using both lat and long values in one operation

Try altering your Regular Expression such that the bar before Longitude is replaced by an ampersand:

&(?:latitude=(?-?(?:\d+.)?\d+)&longitude=(?-?(?:\d+.)?\d+))

my goodness, it worked!! thank you so much!!!

2 Likes