If I have point coordinates
CSV file ot text file
P1,30.79036,31.40862
P2,30.79042,31.40904
P3,30.79009,31.40933
P4,30.78972,31.4094
I want to import file to my app and and use each point data to draw it on bingmap
for each point How can I extract point data
1- I want to make Global Variable list from lat,long coordinate
2- and make global variable for point name
Coordinate List
This is my attempt and I don't know if it is correct or not
What I'm missing is how to separate the coordinate and point name for each point separately and put them inside a list
TIMAI2
June 29, 2024, 8:19pm
2
Use these blocks in your empty sockets:
The button does not browse folders and gives me an error 2101
Taifun
June 29, 2024, 9:01pm
4
from where? the assets? somewhere else?
this
should be a filename, but as you can see from the error message it is a directory name...
do you want to read a file form the assets?
just set filescope to Assets and use the filename without path
Taifun
Taifun
June 29, 2024, 9:04pm
5
Eng_A.Abdelaty:
If I have point coordinates
CSV file ot text file
P1,30.79036,31.40862
P2,30.79042,31.40904
P3,30.79009,31.40933
P4,30.78972,31.4094
to convert a csv table into a list of lists use the list from csv table block and assign it directly to your list variable
Taifun
Here is a tutorial showing how to do something similar with the MIT Map using a csv:
[NP.png] National Parks ... display Markers, calculate distances to Markers and determine closest Marker using the MIT Map Component
[AllParks.jpg]
The Tutorial
This tutorial demonstrates how to use the MIT Map component to display a large number of run time location Markers, calculate the distance from the Android device to all the displayed locations and display that information. A bubble sort creates a list of locations in ascending distance from the device. The first item in the calcul…
You probably could do something similar with your Bing Map. to plot the csv coordinates.
A heads up. that might make a difference in how you code your app.
Be aware, the Bing Maps api is being retired .
Bing Maps SDK for Android and iOS is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps SDK for Android and iOS until June 30th, 2025. Enterprise account customers can continue to use Bing Maps SDK for Android and iOS until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps SDK for Android and iOS will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type.
The overview page for the Bing Maps SDK for Android and iOS section contains links to information about Bing Maps keys, license and terms of service and to the different topics covered such as getting started with Android and iOS, map control...
This may cause Bing Map users an issue next year
1 Like
Taifun
June 29, 2024, 9:41pm
9
what is your filename?
myCoordinates.csv?
put that as filename to read the file
EDIT: and to set the correct scope use the Scope property from the file component and set it to Asset
also do NOT use the add items to list block...
assign the list directly like this
set global from_csv_to_list to list from csv table get text
Taifun
1 Like
No I I want the user to be able to pick any csv or text file
Taifun
June 29, 2024, 10:22pm
11
from where? assets? shared storage?
try the filepicker component https://ai2.appinventor.mit.edu/reference/components/media.html#FilePicker
btw it is list from csv table...
Taifun
I CAN NOW PICK ANY TEXT FILE FROM PHONE
USE TEXT CONTENT TO DRAW POINTS ON MAP
Some files were read without problems, while others gave me an error message
my PointCoordinates1.csv (238 Bytes)
Taifun
June 30, 2024, 1:45pm
16
From which directory did you try to pick the file?
When did it work and when not?
Which Android version are you using for your tests?
From an Android point of view there are an → Internal Storage and an → External Storage .
1. Internal Storage
The Internal Storage can only be accessed with a rooted device.
1.1 The app package is saved in
/data/data/<packageName>/
In order to be able to debug your app, AI2 saves the assets for → Companion on devices with
Android ≥ 10 (API ≥ 29):
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/
Android < 10 :
/storage/emulated/0/Android/data/edu.mit.a…
To read non media files which have been created by other apps you have to use SAF... to pick one of those files i.e. a text file of your choice from shared storage I think you also can use the filepicker component... I'm not 100% sure, because I did not test this...
Taifun
this file working
ffPointCoordinates18.csv (446 Bytes)
location : / internal storage /DOCUMENTS/
but this file not working
my PointCoordinates1.csv (238 Bytes)
location : / internal storage /DOCUMENTS/
The different between them in the content
the second not working content
P1,30.78972106835117,31.40794463947712
P2,30.789692266392713,31.408396843153223
P3,30.78937784449846,31.40859507516323
P4,30.78890340939052,31.408433723527178
P5,30.78879940133065,31.40786165863572
P6,30.789361043320525,31.407554880979642
app read path and name only and cant read content
TIMAI2
June 30, 2024, 2:20pm
20
Try putting both files in the same directory, do they both work / not work ?
two file are in the same path : / internal storage /DOCUMENTS/
I note that
In the emulator the text in the first file copied and give me
the second file not copied
After exporting apk file and try the two file the same error message for two files
and nothing copied