Google Earth Api - programmatically enter StreetView mode - google-earth

I'm trying to give google earth api a start point which I get back from
Google map Api v3(I have lat and lng). The thing I want to do is give a location to
Google Earth and it can automatically moved to street view level.
So far what I did can only move to ground level.
The following code is how I try move Google Earth's camera
var lookAt = DS_ge.createLookAt('');
lookAt.setLatitude(myRoute.steps[0].path[0].lat());
lookAt.setLongitude(myRoute.steps[0].path[0].lng());
lookAt.setRange(1000.0); //default is 0.0
DS_ge.getView().setAbstractView(lookAt);
Is there any way to achieve the result like I move the pegman to the location I want and show the street view.
I think there's a pegman function make it work but I can't find it.
Any suggestion will be helpful thx :)

To programmatically enter StreetView mode you need to add a gx:ViewOptions element to the LookAt element:
var lookAt = ge.createLookAt('');
// ... set your LookAt parameters
// don't forget default Altitude mode is ClampToGround
lookAt.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND)
// enable Street view option on ViewerOptions and add that to LookAt
var viewerOptions = ge.createViewerOptions('');
viewerOptions.setOption(ge.OPTION_STREET_VIEW, ge.OPTION_STATE_ENABLED);
lookAt.setViewerOptions(viewerOptions);
ge.getView().setAbstractView(lookAt);
To control whether the user can enter Street View using manual navigation controls, call
var navcontrol = ge.getNavigationControl();
navcontrol.setStreetViewEnabled(true);

Related

How can I get the current distance from earth inside the Map?

I would like to maintain the current zoom level when a location change is triggered.
Currently, I display the location as follows:
_mapController.camera
.lookAtPointWithDistance(coordinates, distanceInMetersFromPosition);
The problem is that the user can zoom in or out and then move and as soon as the position changes, the piece of code is triggered again. So my question is:
Is there a callback for changing the distanceInMetersFromPosition or can I somehow get the current distanceInMetersFromPosition or zoom? I didn't find any documentation about this so far.
I’m using the "HERE SDK for Flutter (explore Edition) - Version 4.3.2.0".
The camera contains information about the current state. You can call the following:
double distanceInMetersFromPosition =
_mapController.camera.state.distanceToTargetInMeters;
Alternatively, you can use lookAtPoint(coordinates) when you just want to update the location without changing the zoom. If you are interested in callbacks, you can attach an observer to the camera with addObserver(MapCameraObserver observer). This will notify you whenever the user has zoomed or panned the map.

Leaflet height fullscreen fixed

I was trying Leaflet, the display looks like Google Maps, but I find a lot of ways cannot meet my requirements. Is there any way in the web, the phone shows the following?
Bad display:
The first time it is entered, it can be dragged to the outside of the screen.
Good display:
The first time it enters it is highly full-screen and cannot be dragged.
Have a look at the Leaflet documentation for initialising the map. You can pass several options that will do what you want:
var world = new L.LatLngBounds([[90,-180],[-90,180]]);
var map = L.map('map', {
minZoom:2,
maxBounds: world,
maxBoundsViscosity: 1,
}).setView([0,0], 0);
Setting minZoom stops users being able to zoom out so far that the top and bottom of the map are both visible (and overrides the zoom value passed to setView()). You may need to calculate an appropriate value based on the height of the screen, and how much of the world it is useful to display in your application. On its own, this still lets users pan off the edge of the map.
Setting maxBounds limits the view to a specific set of coordinates (the whole world in the example above). You also have to set maxBoundsViscosity to stop users being able to pan the map beyond these limits.
If you really don't want users to be able to pan the map at all, you can also set dragging: false. This still lets you pan the map using the .panTo() method.

Google Map SDK Swift, Zooming in and out like Uber's Map

I am trying to implement the Google Map SDK, and so far I have implemented a marker. I made the marker in a way that it follows as it is located in the center when I move the camera position.
The problem is that I can't zoom in and out while the marker's location is not changing. I would like to make the zooming experience like Uber in which the location does not change.. Thank you for your help.
You can use this line allowScrollGesturesDuringRotateOrZoom to your GMSMapview. It controls whether rotate and zoom gestures can be performed off-center and scrolled around. The default value of this is YES.
mapView.settings.allowScrollGesturesDuringRotateOrZoom = false // NO for obj-c and false for swift
So by setting it by NO/false, you can now perform zooming while the marker location is not moving. For more information, check this thread.

how to get current location as i slide the MapView?

I am using CLLocationManager to retrieve current location in my app and display using MapView, i want to slide the map so that the current location should also change to the new location where the map slides and it should annotate to the new location, how to do it? Please give your suggestions with sample code.
You probably don't mean "the current" since that means where the phone actually is, unless you want to transport the phone to another place when using this app which would be quite a feat. So, how about drawing a layer over the top of your map that keeps a pin drawn at the centre so it looks as if the pin is moving over the map, but really the map is moving under the pin.

How to mark position of iPhone on Google Map?

I want to make a webpage with a Google Map that marks the geographical position of my iPhone, how do I go about this?
I've looked into the Google Map API section on markers - so I can make a static marker, but I don't know how to pull the GPS data from my iPhone.
Answer is here: iPhone current user location coordinates showing as (0,0)