Info

This question is closed. Reopen it to edit or answer.

Obtain GPS within a specific region

1 view (last 30 days)
Dan
Dan on 26 Oct 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello everyone,
I have a large set of GPS locations, however I am only interested in obtaining those GPS locations that fall within a specific region, for this example let's say England.
I currently approach the problem using Google API (with usage limits):
longitude = 2.2333;
latitude = 53.4667;
%Generate the string to Pass over to Google
url = sprintf('https://maps.googleapis.com/maps/api/geocode/xml?latlng=%.4f,%.4f&sensor=true', latitude, longitude);
Google returns an XML structure that is stored in a "buffer"
buffer = urlread(url);
With this information, I perform a search to identify if the XML file provides any mention of England.
%Obtain the formatted address
results = regexp(buffer, '<formatted_address>(.*?)<', 'tokens') ;
%Search and store any mention of 'England'
resOut = [];
for k = 1 : length(results)
resOut = [resOut,strfind(results{k}{1}, 'England')];
end
Question: Is there a "cleaner" more efficient way of identifying GPS locations within a specific region?

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!