Does Street View Static API support markers - google-street-view-static-api

Are markers supported in Street View Static API? I am not getting a marker back, and I see no documentation provided for using markers with street view static images.

Documentation from Google indicates that street view markers are supported:
https://developers.google.com/maps/documentation/ios-sdk/streetview#markers_within_street_view
an example is:
// Create a marker at the Eiffel Tower
let position = CLLocationCoordinate2D(latitude: 48.858, longitude: 2.294)
let marker = GMSMarker(position: position)
// Add the marker to a GMSPanoramaView object named panoView
marker.panoramaView = panoView
// Add the marker to a GMSMapView object named mapView
marker.map = mapView

Related

Mapsui adding map pins in Xamarin Forms

I need to add a bunch of pins on a MapsUI map control that uses OpenStreetMap tiles.
The problem is I cant find anything mentioning pins in their documentation so my question is:
Are there any pins available but have different names or i have to draw pins myself (using Geometry and Points as in some examples i found) and if so how do i keep them the same size when zooming the map ?
Maybe someone can point out where should i look in their documentation in case I'm blind and missed it.
Thanks!
Your Mapsui Map View Mapsui.UI.Forms.MapView has property Pins. You can add pins there.
You can access MapView View from code-behind *xaml.cs of your MapView.
For that, first, name your Map View in XAML Page:
<ContentPage
xmlns:mapsui="clr-namespace:Mapsui.UI.Forms;assembly=Mapsui.UI.Forms"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="YourProject.Pages.YourMap">
<ContentPage.Content>
<mapsui:MapView
x:Name="selectMapControl"/>
</ContentPage.Content>
</ContentPage>
Then access it from C# code-behind of that Page:
using Mapsui.UI.Forms;
protected override async void OnAppearing()
{
selectMapControl.Pins.Add(new Pin(new MapView())
{
Position = new Position(0, 0),
Type = PinType.Pin,
Label = "Zero point",
Address = "Zero point",
});
}
Hope this simplest example will help.
The idea is that you use your own bitmaps to draw as 'pins'.
Mapsui has features. A feature has a geometry which can be a point, linestring and polygon (and some others). A feature is drawn with some kind of style. What you need to do is create features with point geometry and use a symbolstyle with a bitmap as symbol. You need to register your bitmap and use the bitmapId in the symbol. See the sample here:
https://github.com/Mapsui/Mapsui/blob/master/Samples/Mapsui.Samples.Common/Maps/PointsSample.cs
You can use Xamarin.Forms.GoogleMaps as they give you the feature to add multiple pins of your choice.
Here is the sample code :
var position = new Position(Latitude, Longitude);
var pin = new Pin
{
Type = PinType.Place,
Position = position,
Icon = BitmapDescriptorFactory.FromBundle("pin.png"),
Label = "custom pin",
Address = "custom detail info",
};
MyMap.Pins.Add(pin);
The following works on version 3.02. I've not checked it on any other version of MapSui.
First make sure your pin Bitmap is an embedded resource. You can then get the Bitmap ID like this:
var assembly = typeof(YourClass).GetTypeInfo().Assembly;
var image = assembly.GetManifestResourceStream("YourSolution.YourProject.AFolder.image.png");
If var image returns null, then the image was not found and it's likely not an embedded resource or you got the address/name wrong.
var ID = BitmapRegistry.Instance.Register(image);
The BitmapRegistry method also registers the BitMap for MapSui to use later. I think if it's your first image registered it will be 0.
Then you can create a memory layer as follows:
MemoryLayer PointLayer = new MemoryLayer
{
Name = "Points",
IsMapInfoLayer=true,
DataSource = new MemoryProvider(GetListOfPoints()),
Style = new SymbolStyle { BitmapId = ID, SymbolScale = 0.50, SymbolOffset = new Offset(0, bitmapHeight * 0.5) };
};
The DataSource can be generated as follows (I'm just adding one feature, but you can add as many as you like):
private IEnumerable<IFeature> GetListOfPoints()
{
List<IFeature> list = new List<IFeature>();
var feature = new Feature();
feature.Geometry = new Point(-226787, 7155483);
feature["name"] = "MyPoint";
list.Add(feature);
IEnumerable<IFeature> points = list as IEnumerable<IFeature>;
return points;
}
Then add the new MemoryLayer to your Map as follows:
MapControl.Map?.Layers.Add(PointLayer);

Google map autocomplete get LatLngBound?

how to get latlngbound in places get by autocomplete?
for getting latitude i use the following code
var place = places.getPlace();
var latitude = place.geometry.location.lat();
However it is not working when i try following code to get latlngbounds
// northeast is undefined
var latlngbounds = place.geometry.bounds.northeast.lat();
// undefined
var latlngbounds = place.geometry.bounds;
The PlaceGeometry also includes a suggested viewport, which is a google.maps.LatLngBounds object. (Its name is viewport, not bounds, however)
Properties Type Description
location LatLng The Place's position.
viewport LatLngBounds The preferred viewport when displaying this Place on a map. This property will be null if the preferred viewport for the Place is not known.
var place = places.getPlace();
var latitude = place.geometry.location.lat();
var bounds = place.geometry.viewport;

Display photographer's name in Business View via Google Maps Javascript API v3

Is there any way to read and display the photographer's name in Google Maps Business View using Google Maps Javascript API v3? I can't find any hint in the reference and I don't get the problem solved.
Thanks, Stefan
You could use the #copyright param from the panorama.
https://developers.google.com/maps/documentation/javascript/reference#StreetViewPanoramaData
For example you could do this:
var center = new google.maps.LatLng(-31.416676, -64.1841580000002);
var streetViewService = new google.maps.StreetViewService (document.getElementById("map"));
streetViewService.getPanoramaByLocation(center, 30, function(panorama){console.log(panorama.copyright);});
This would create a new instance of streetViewService, then you ask for the panorama related to the "center" variable and finally, you could use the copyright variable.
Also, you could use just the description field from the location variable returned from the same getPanoramaByLocation call:
var center = new google.maps.LatLng(-31.416676, -64.1841580000002);
var streetViewService = new google.maps.StreetViewService (document.getElementById("map"));
streetViewService.getPanoramaByLocation(center, 30, function(panorama){console.log(panorama.location.description);});
Hope it helps.

OpenLayers: convert EPSG:3006 to EPSG:4326

I'm trying to use a program that loads coordinates in EPSG:4326 format and plots on a map. The problem is that my coordinates are in EPSG:3006.
Is there any function to convert one projection in OpenLayers to another EPSG?
The better way to do this is to use proj4js library here, it is simple and you can add custom projections if you want.
Below you can see how it works:
var SourceProjection= new Proj4js.Proj('EPSG:4326');
var DestinationProjections= new Proj4js.Proj('EPSG:3006');
var Point = new Proj4js.Point(longitude, latitude);
Proj4js.transform(FirstProjection, SecondProjections, ne);
Or if you want to do it from openlayers you can use the "transform" function of geometry, here is a custom function that I use:
function TransformGeometry(geometry, SourceProj, DestProj) {
geometry.transform(
new OpenLayers.Projection(SourceProj),
new OpenLayers.Projection(DestProj));
return geometry;
}
In any case you have to declare proj4js in HTML tag in order to use a "long list" of projections (including here and custom projections you create).

Difficulty with the image quality of the map generated with Bing Map Api

I'm developing an application that retrieves an image of "Bing Maps" with [Bing Api] since my webService.
My problem is the rendering of the image.
If I set my zoom greater than 11,or if I set a size too big, the result of recover my image is like "cut" into several loading and gives the impression that the image is not entirely downloaded.
Example picture below...
Have you any idea why the image looks like its back?
Here is my code used in my webService.
//call function
GetImageMap(46,6,800,800,17);
//Get Bing map Image from the web
public string GetImageMap(double latitude,double longitude,int mapSizeHeight, int mapSizeWidth, int zoomLevel)
{
string key = "asoidfz9aos78fa9w3hf9w3fh9hf7ha9wfw37fhblablablablablabla";
MapUriRequest mapUriRequest = new MapUriRequest();
// Set credentials using a valid Bing Maps key
mapUriRequest.Credentials = new ImageryService.Credentials();
mapUriRequest.Credentials.ApplicationId = key;
// Set the location of the requested image
mapUriRequest.Center = new ImageryService.Location();
mapUriRequest.Center.Latitude = latitude;
mapUriRequest.Center.Longitude = longitude;
// Set the map style and zoom level
MapUriOptions mapUriOptions = new MapUriOptions();
mapUriOptions.Style = MapStyle.Aerial;
mapUriOptions.ZoomLevel = zoomLevel;
mapUriOptions.PreventIconCollision = true;
// Set the size of the requested image in pixels
mapUriOptions.ImageSize = new ImageryService.SizeOfint();
mapUriOptions.ImageSize.Height = mapSizeHeight;
mapUriOptions.ImageSize.Width = mapSizeWidth;
mapUriRequest.Options = mapUriOptions;
//Make the request and return the URI
ImageryServiceClient imageryService = new ImageryServiceClient();
MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);
return mapUriResponse.Uri;
}
// ### END Function getImageMap
And the url query:
http://api.tiles.virtualearth.net/api/GetMap.ashx?c=46,6&dcl=1&w=800&h=800&b=a,mkt.en-US&z=17&token={token}
Result image.. :
It seems to be related to the aerial imagery and it's not technically related.
I will report it to the appropriate team.
By the way, you should use the REST Imagery API which is the official way to use the imagery from Bing, see the MSDN:
http://msdn.microsoft.com/en-us/library/ff701724.aspx
Here is a sample URL based on your example:
http://dev.virtualearth.net/REST/v1/Imagery/Map/Aerial/46,6/17?mapSize=800,800&key=YOURKEY

Resources