Location sensor marker my location

I have made a block for location sensor with a button,latitude ,longtitue and i wonder if it can been shown a marker with my exactly location when i click the button to find my location ?
image
image

There are a lot of ways to do this. One way is to use a Button event handler (Button.Click) and add a design time Marker1 to your Project:

showMarker
:wink:

These Blocks will work if your gps hardware has a satellite fix.

1 Like

well i already have a marker 1 and i don't want to loose its position but when i do this block you send me with the marker 2 (which i want to be the marker for my location )it doesn't work also my gps hardware has a satellite fix cause it send me in my location when i click the button but i doesn not appear the marker.
image

Testing using the emulator will not work. Use a real device and make sure you have a WIFI or Data connection ( so you can access OpenStreetMap to see the map).

The provided Blocks work here using an Android 13 cell phone.
postLocationOnAMap.aia (2.1 KB)

Well i tested the app on my phone and the button "get location"provides me with a broder area of my location .What i would like to do is on this exact location to have a specific pin point(marker).

Sorry, I do not understand what you mean.

Perhaps you need a higher zoom value; perhaps 15 instead of 5,

Or you need to change the way the location is centered using a different way than using Map.PanTo (The PanTo method sometimes hangs up on some devices and does not display the Marker.).

You might try using the alternative code Blocks in Button2 which is more stable than PanTo.


and change the zoom to 15. That may give you what you want.

  • you may want to test this outside of your building
  • if it does not work for you, do a screen capture of what it does display and post the image here.
  • tell us what Android version you are using and confirm you are not using an emulator.

so lets take it more clear!


With the first block picture ,the result on the phone is

the right down marker i want it to be stable in the coordinates it has (called Marker 1) and the left up marker is set in this point random so i want to be the specific marker of the phone coordinates when i click the button "get location",exactly it should be inside the black circle as shown in the picture .Now when i click the button "get location" it send me to a broader area but not in the specific coordinates of the phone.
.
For the next option you send me as shown below ,when i click the button "get location" it send me out of country !!

OK. Thanks. The image you posted shows me you are using App Inventor for ios. Is that true? I don't have an ios phone and I do not know what is wrong.

If you can borrow an Android cell phone, you might test the code and aia I posted earlier in an Android phone. The code will work using an Android device. I don't understand why the code does not with Apple. :wink:

Maybe Evan at MIT @ewpatton can tell us.

Seems the only function Maps cannot yet do on ios is FeaturesFromGeoJson:

Your components:

image

Try with just a couple of design time markers without the FeatureCollection