MapView

Former Member
Former Member
This is still beta version and new feature - so I'm not expecting everything to work just fine, but :)

- Seems that MapView can't be implemented on the main view for application, inherited class can't be returned from getInitialView of Application
- the way setScreenVisibleArea is working seems to be completely wrong - at least in simulator (haven't yet pushed any of my tries on my watch)
it seems to modify visible map area instead of setting area of screen to show the map

to be more precise - I'm setting area of interest:

var top_left = new Position.Location({:latitude => 50.01, :longitude =>21.8, :format => :degrees});
var bottom_right = new Position.Location({:latitude => 49.9, :longitude =>22.2, :format => :degrees});


MapView.setMapVisibleArea(top_left, bottom_right);

Then setting something like:

MapView.setScreenVisibleArea(0, 0, 120, 10);

Would result in showing of half of the Europe on full screen instead (that's my guess at least) of map area on small box of size 120x10 in upper left corner
  • I'm pushing mapView from the main view in one of my apps (it's one of the screens in the app), and not tied it as the main view.
    for setMapVisibleArea(), I set that up using the min/lax locations for my data

    Now setScreenVisibableArea() is what part of the screen is used for that visible area, in in your case, it's 120 pixels by 10 pixels, so the full screen wil be a very large area, like half of europe..

    Here's what I'm using with the f5x in the sim

    MapView.setScreenVisibleArea(20, 20, width-20*2, height-20*2);

    I set the screen area to the whole screen, with a 20 pixel border on each side. He's a screen shot from the sim. My app is drawing the polyLine and markers.
    community.garmin.com/.../1363406.png
  • Former Member
    Former Member over 7 years ago
    Jim,
    setScreenVisibleArea - that makes sense, had to misunderstood dev guide, thanks!

    For using not as a main view - this is not a big deal, but simply I feel - this is a bug to not to have it possible (or will have to be mentioned in the guide)

    Thanks!
    Stan
  • Former Member
    Former Member over 7 years ago
    The visible area is working as designed. These attributes are informing the system what area of the screen you want the map focused and zoomed to. The expectation is your view's update method will be overlaying the other areas of the screen with user interface, but the map will still render behind these overlays. If you do not wish for the map to show behind your UI elements, you can blank all of the area outside the area you specified as usable with dc.drawRectangle() calls prior to drawing UI elements.
  • Is mapView only available on watches that have full mapping like the Fenix5x and now Fenix5 plus series? What about a watch like the 935? I know you won't have full mapping, but will you be able to incorporate the bread crumb map into an app? I currently role my own but it uses a lot of resources. I'd love to be able to add a secondary track to my track, even in just bread crumb mode, like that of the dogs from the Garmin Alpha.

    What about Edge devices like the 1030?
  • ekutter - I think it's only for devices with on-board maps - the f5x and 1030 in the 3.0.0b2 SDK.
    In the programmer's guide it does say this for mapping:
    Connect IQ 3.0 enables developers to embed map views into their apps on products with onboard cartography. Mapping is accessible in two ways: The WatchUi.MapView and the WatchUi.MapTrackView.


    As far as breadcrumbs, it's really not that difficult, just a large amount of data. You figure out the bounds of the screen, and for what you want to draw, convert the location to an x/y on the screen. Here's the same .fit I was using in the mapview picture but doing my own breadcrumbs. (I stretch the screen to make use of as much as I can, so here, it's a bit screeched right/left)



    community.garmin.com/.../1363875.png
  • ekutter - I think it's only for devices with on-board maps - the f5x and 1030 in the 3.0.0b2 SDK.
    In the programmer's guide it does say this for mapping:


    As far as breadcrumbs, it's really not that difficult, just a large amount of data. You figure out the bounds of the screen, and for what you want to draw, convert the location to an x/y on the screen. Here's the same .fit I was using in the mapview picture but doing my own breadcrumbs. (I stretch the screen to make use of as much as I can, so here, it's a bit screeched right/left)





    Thanks Jim. I haven't installed the 3.0 beta yet so haven't been able to try it. And sounds like won't help me personally much at this point. As I mentioned, I do have such code that I have written and use currently, but it'd be nice to be able to take advantage of the built in services since they can be much more efficient with resources as they are written in native code. At the same time, if they ever come out with the 935 Plus that includes full mapping, that might be enough to get me to upgrade.
  • Just out of curiosity, do you think that the MapView feature not being available on lets say Fenix 5 or 935 is due to a hardware limitation (eg. ram) or due more to marketing reasons?.
  • MapView/MapTrackView is only available on devices with on board maps, and devices like the f5 and 935 don't have maps and there wouldn't be room on the devices to add maps.

    It's not a marketing reason.