1

Is there anyway to plot my data consisting of lat/lon and some feature values in google map from matlab. I have certain data points having different properties based upon that I want to show like markers with different color/size on google map. Is that possible

user745089
  • 113
  • 1
  • 2
  • 6
  • I think you can write up matlab code that generates JavaScript into a file, then load that output file – Tina CG Hoehr Sep 28 '12 at 04:30
  • Just to be clear on what you're asking, are you saying that you start with data (lat/long and features) in matlab and would like to end up with this data plotted on a google map? – grungetta Sep 28 '12 at 10:14

2 Answers2

2

Google Maps allows you to import data in the form of a KML file. There are various tutorials available online that show how to perform this import step (here's one that I just quickly found). Also, here is some basic info on KML from google.

So then the only challenge becomes exporting your data from MATLAB into KML form. If you have MATLAB's Mapping Toolbox, then this is extremely easy. Just use the kmlwrite command.

If you don't have the Mapping Toolbox, already, it's probably a good idea to have if you are performing any sort of complex mapping operations (things get pretty complicated when you try to flatten a round globe into a map). If this is just a one-off project and that toolbox is overkill, then you may be able to manually create a KML file by writing XML from MATLAB (either using xmlwrite or going the very manual route of writing with fprintf).

Additionally, I would not be too surprised if Google Maps allows you to import certain data in the form of CSV files (though perhaps this has limitations compared to KML). If so, you can simply make use of csvwrite from MATLAB to export your data (no extra toolboxes required).

==EDIT==

If you'd like to find out how to convert from CSV to KML, this previous SO post might help.

Community
  • 1
  • 1
grungetta
  • 1,089
  • 1
  • 7
  • 8
0

There is the KLM-Toolbox that doesn't require the matlab Mapping Toolbox:

http://www.mathworks.com/matlabcentral/fileexchange/34694

It should do the job.

porl
  • 11
  • 1