How could i import google map into matlab using mapping toolbox,with dynamic view?

11 views (last 30 days)
I would like to import google maps into matlab by using mapping toolbox in order to edit a specific city region of the map with dynamic view.Then everytime i click on a building, matlab should be able to display some informations, which i would have provided.

Answers (1)

Anshuman
Anshuman on 12 Sep 2024
Hello,
Based on my understaing, here are few general steps that you can follow to achieve this functionality:
  • Obtain map data for the city of interest. You can use publicly available datasets like OpenStreetMap (OSM) or other GIS data sources. Convert the data into a format that MATLAB can read, such as shapefiles (.shp).
  • Load the Map Data in MATLAB and use the "mapshow" function to display the map data. Customize the view using functions like "xlim", "ylim", and "zoom" to focus on specific regions.
  • Use MATLAB's UI components to create interactive elements. For instance, use "uifigure" and "uipanel" to set up a GUI. Implement a callback function to handle mouse clicks on the map.
  • Use the "ginput" function or "ButtonDownFcn" property to detect clicks. Identify the clicked building by checking the coordinates against your map data.
  • Create a data structure or database that associates building coordinates with information. When a building is clicked, retrieve and display the associated information in a pop-up or UI panel.
Hope it helps!
  1 Comment
Edoardo
Edoardo on 12 Sep 2024
Edited: Edoardo on 12 Sep 2024

What a great response! I’ve looked into this quite extensively for a project so I’ll add my own two cents

  • Don’t reinvent the wheel, create a geoaxis and geoplot. If doing a matlab app parent that to a panel
  • Requesting singular google tiles has the google logo on the bottom right you can’t remove by TOS so these will tile as well
  • Overlaying images on an axis might obscure clicking on the axis callback but ginput should still work but you will be forced to use it if going the google tiles approach
  • I’ve managed to extract data as coordinates from the OSM Overpass API. I mapped ways into their singular nodes which were referenced elsewhere in the API response, for my application that was easier since I needed to snap closeby features to a path and I did that using closeby points. (If you need to extract road paths and such shape files should be the right approach).
  • Using OpenRouteService API you can, extract points of interest (POI’s) in your area and display them on your map. You could also reverse geocode where the user presses then display that location.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!