Skip to content

[@nativescript/google-maps] Adding a ground overlay #300

Closed
@tommag21

Description

@tommag21

Hi, I'm struggling to add a ground overlay and I can't find examples in the documentation or other threads. I'm testing on Android.

This is what I have tested so far:

map.addGroundOverlay({
  visible: true,
  image: await ImageSource.fromUrl("https://maps.lib.utexas.edu/maps/historical/newark_nj_1922.jpg"),
  bearing: 0,
  zIndex: 10,
  // transparency: 0,
  bounds: {
    northeast: { lat: 40.773941, lng: -74.12544 },
    southwest: { lat: 40.712216, lng: -74.22655 }
  }
});

If I specify bounds I get this exception: "java.lang.IllegalArgumentException: Options doesn't specify a position".

map.addGroundOverlay({
  visible: true,
  image: await ImageSource.fromUrl("https://maps.lib.utexas.edu/maps/historical/newark_nj_1922.jpg"),
  bearing: 0,
  zIndex: 10,
  // transparency: 0,
  position: { lat: 40.773941, lng: -74.12544 },
  anchorU: 0,
  anchorV: 1,
  height: 1000,
  width: 1000
});

If instead I specify position, anchorU, anchorV, height and width, I get: "Error: java.lang.IllegalArgumentException: Location must be specified".

What is the correct way to initialise a ground overlay?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions