RenderServiceSoap.ConvertToPoint Method

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  LatLong(), ByVal view As MapView, _
ByVal width As System.Integer, ByVal  height As System.Integer ) As PixelCoord()


[C#]

public PixelCoord[] ConvertToPoint
  ( LatLong[] latLong , MapView view , System.Int32 width ,
  System.Int32 height );

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.

Example

[Visual Basic]

'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#]

//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   |   Client-Side Point to Latitude/Longitude Conversion Sample