CreateMarker from CSV File of Latitude and Longitude

Hello MIT App Inventor Community,
I am writing an application to read in a CSV file of latitude and longitude data. The program reads the data into two lists, one containing the latitude and one the longitude. When I call Map1.CreateMarker routine, I receive a Runtime error that the marker cannot accept the arguments. Here is a screenshot to show the code, CSV file, and error. Any advice is greatly appreciated.


Thanks!
Sharon

This could be as simple as making sure this box is unchecked

notJSON

Try unchecking ShowListsAsJson.

If not you need to explain how you get your csv file.

Looks like you are trying to set a list of lists e.g. [lat] instead of lat.

Try select item from list, index 1 on your global LatNum / LongNum

Hi SteveJG,
Many thanks for your reply. I tried the "uncheck" of the ShowListsAsJson and received the same error. Here is a screen annotation to explain my strategies and an image of my Android phone paired with the app. The program's purpose is to provide the user with their location on a map when the "Drop a Pin at My Location button is pressed - which works. Then, I want to drop pins for the ten lat/long pairs, I want to create a marker for each of the locations. I have a "debug" label at the bottom of the screen that shows the contents of the table of lat/long pairs.


Many thanks. Best, Sharon

Hi TIMAI2,
Thanks for your reply. I changed the code as follows to what I believe you suggested. It still throws the same error:


Many thanks, Sharon

Does this block stack cause the same issue?

Note, you can drag and drop the image into the App Inventor blocks editor to add it to your project.

1 Like

Assuming the csv text you are getting back looks like mine...

image

I would do this differently.
Here is the part tapping the map to add a point.


AddLocation.aia (2.2 KB)

tapMap Your app can be made more simply. :0

Many thanks! I will try it now. Best, Sharon


This causes the same error.

where the csv is
latlonCSV.csv (69 Bytes)

Hi SteveJG and TimAI2,
Here is the solution that worked. One of my students wants to plot the location of microplastics in the Shinnecock Bay of Long Island. I took the original longitude and latitude data and verified the locations in Google. The first location was invalid; hence, the program could not plot the location. I selected four verified locations and entered them into the join block of the CSV table. Now the location markers plot to the correct locations. I suggested that my student only plot up to four to five locations at a time since the "real estate" of the MIT App Inventor screen is too small to plot 65 data points in her original file. Thank you so much for all of your help! I will try the DoubleTapAtPoint in another version of the program.
Best Sharon

Not necessarily true. The map can show the entire extent of the samples and zoom in for detail. Your student can plot all of the locations using one file. Use the zoom and pan capabilities of the Map to view at different 'magnification' and locations.

Thank you, SteveJG I will try this solution. Best, Sharon

Hi SteveJG,
Here is my solution that works with a CSV file. Many thanks!

2 Likes