GPS with customized routes

I’m new to programming. I have a doubt regarding the creation of a GPS with customized routes for example routes on dirt roads. there would be some way for me to draw this route and the gps follow as per pre-defined drawing. I would like to know where I start, I was looking at the geojson.io website, which already gives me a drawing of the route, but how to make this co-relationship between a manual route x gps operation

You want something like polylines? or what? i didn’t understand you well.

i didn’t understand this.What do you mean by a gps.The location sensor?

You can draw this lines on google maps using the json code provided with this block:


Or without using json text.You can use list of list of pairs each pair contains latitude and longitude.

This ?
One simple test.

1 Like

exactly, but on unpaved roads where there are no predefined paths

image

You can define your routes your self be making a list of pairs of the points like ((25.87678 23.890789)(87.8789 ))
Then using this block to display on map:
component_method
Here is an example:
blocks (11)
Or using json:

I understood.
but how a gps can understand and follow this polyline. need some API?

What do you mean with gps? Can you post me the name of the component or extension that makes this?You mean the marker?

a navigator that show me the time the distance speed limit . Sorry maybe I couldn’t express myself :slight_smile:

You use the navigation component?

You mean the estimated time to pass this route.

You mean the max speed you can drive in this route?

kodular have some component for this or need to import some extension or api to
follow the polyline

yes a way to calculate this

my question is google maps can interpret this polyline as a navigation system, what is needed? there is something in the kodular for that

image

I think now i understood you.You need to create an api key here:
https://openrouteservice.org/ then use the navigation component to get the directions between two points.The first point and the last point.You will get the distance and time as well.

You mean, use the API, right? This image I posted is of this API. Did the new version of Kodular create this component or not?

1 Like

Sorry :sweat_smile: i meant create an api key.I will go and edit my first post.

1 Like

GPS in your app ?

1 Like

I drew a path in geojson.io I copied all the text but when I run an error.


this error
image

what can be wrong?

Shouldn’t you just take the latitude and longitude pairs of numbers?

That error happens when using get points from json or adding polyline.
P.S: the meaning of the error, that you’ve entered a string , in a place it should be a number.

I am also looking for this. Stil i nit solve this.

Each time you will search here. Their have any api for this.

I tried to put

[[-48.329758644104004,-21.39739875595992],[-48.34134578704834,-21.39693924638317]]

this information without space between the numbers, just to give me only a line
but give an error:
" Attempt to invoke virtual method ‘com.google.android.gms.maps.model.Polyline com.google.android.gms.maps.GoogleMap.addPolyline(com.google.android.gms.maps.model.PolylineOptions)’ on a null object reference
Note: You will not see another error reported for 5 seconds."

if I replace “[” with “(”
((-48.329758644104004,-21.39739875595992),(-48.34134578704834,-21.39693924638317))

gave another error :

The operation AddPolyline cannot accept the arguments: , [nothing], [20], [-81913]
Note: You will not see another error reported for 5 seconds.