Share via


RenderServiceSoap.ConvertToPoint Method

Converts latitude and longitude coordinates to pixel coordinates on a given map. Returns an array of PixelCoord[] objects from a given array of LatLong[] objects.

Public NotOverridable Function ConvertToPoint ( ByVal latLong As
  [Namespace].LatLong(), ByVal view As
  [Namespace].MapView, ByVal width As Integer, ByVal
  height As Integer ) As [Namespace].PixelCoord()
    Member of [Namespace].RenderServiceSoap
[C#]
public [Namespace].PixelCoord[] ConvertToPoint
  ( [Namespace].LatLong[] latLong ,
  [Namespace].MapView view , System.Int32 width ,
  System.Int32 height )
    Member of [Namespace].RenderServiceSoap

Parameters

  • latLong
    The array of latitude and longitude coordinates (LatLong[] objects) for which pixel coordinates are desired. Maximum number of coordinate pairs is 1,000.
  • view
    The defined view (MapView object) of the map image. The MapView object sent should match the one that was used to create the image.
  • width
    The width of the map image in pixels. Integer. The value should match the width dimension passed in the MapOptions.Format property used in the call that created the MapView object.
  • height
    The height of the map image in pixels. Integer. The value should match the height dimension passed in the MapOptions.Format property used in the call that created the MapView object.

Remarks

  • If you are not using the ViewByBoundingRectangle to render the map, view from any image returned from the MapPoint.BR, MapPoint.EU, MapPoint.Moon, MapPoint.NA, and MapPoint.World data sources can be used with the view parameter.
  • If a latitude and longitude coordinate located outside the bounds of the map view is passed in the latLong parameter, a pixel coordinate is returned when that point is located on the visible side of the Earth. Otherwise, null is returned.
  • To convert pixel coordinates to latitude and longitude coordinates, use the ConvertToLatLong method.

Example

 
[Visual Basic] 
'This example assumes that the MapPoint Web Service namespace 
'has been imported 

'Use ConvertToPoint to convert a latitude and longitude coordinate
'to a pixel coordinate
Dim myLatLongs(0) As LatLong
myLatLongs(0) = New LatLong()
myLatLongs(0).Latitude = 47.59
myLatLongs(0).Longitude = -122.34

Dim myView As New ViewByScale()
myView.CenterPoint = myLatLongs(0)
myView.MapScale = 200000

Dim renderService As New RenderServiceSoap()

Dim pixelCoords() As PixelCoord
pixelCoords = renderService.ConvertToPoint(myLatLongs, myView, 250, 250)

Console.WriteLine(pixelCoords(0).X.ToString())
Console.WriteLine(pixelCoords(0).Y.ToString())

 
[C#]
//This example assumes that the MapPoint Web Service namespace 
//has been imported 

//Use ConvertToPoint to convert a latitude and longitude coordinate
//to a pixel coordinate
LatLong[] myLatLongs = new LatLong[1];
myLatLongs[0] = new LatLong();
myLatLongs[0].Latitude = 47.59;
myLatLongs[0].Longitude = -122.34;

ViewByScale myView  = new ViewByScale();
myView.CenterPoint = myLatLongs[0];
myView.MapScale = 200000;

RenderServiceSoap renderService  = new RenderServiceSoap();

PixelCoord[] pixelCoords;
pixelCoords = renderService.ConvertToPoint(myLatLongs, myView, 250, 250);

Console.WriteLine(pixelCoords[0].X.ToString());
Console.WriteLine(pixelCoords[0].Y.ToString());

 

See Also

RenderServiceSoap Class | PixelCoord Class | LatLong Class | MapView Class | MapOptions.Format Property | Client-Side Point to Latitude/Longitude Conversion Sample | RenderServiceSoap.ConvertToLatLong Method