yandex-maps-static-api
Library for working with Yandex Maps Static API 1.x
Done
- Support for map properties
- Support for Polylines
- Curves
- Polygons
- Coordinates encoding
- Support for Markers
Usage
YandexMap yandexMap = new YandexMap();
yandexMap.setMapType(YandexMap.MapType.HYBRID);
yandexMap.setCenter(new Coordinate("37.660286", "55.743301"));
yandexMap.setViewport(new Coordinate("0.005", "0.005"));
yandexMap.setScale(7);
yandexMap.setSize(new Size(650, 450));
yandexMap.setLanguage(YandexMap.Language.RUSSIAN);
Curve curve = new Curve();
curve.setColor(Color.BLACK);
curve.addPoint(new Coordinate("37.656577", "55.741176"));
curve.addPoint(new Coordinate("37.656748", "55.741419"));
curve.addPoint(new Coordinate("37.655131", "55.741814"));
curve.addPoint(new Coordinate("37.658257", "55.742524"));
yandexMap.addPolyline(curve);
Polygon polygon = new Polygon();
polygon.setColor(Color.WHITE);
Curve outerCurve = new Curve();
outerCurve.addPoint(new Coordinate("0", "0"));
outerCurve.addPoint(new Coordinate("0", "4"));
outerCurve.addPoint(new Coordinate("4", "4"));
outerCurve.addPoint(new Coordinate("4", "0"));
polygon.addCurve(outerCurve);
Curve innerCurve = new Curve();
innerCurve.addPoint(new Coordinate("1", "1"));
innerCurve.addPoint(new Coordinate("1", "3"));
innerCurve.addPoint(new Coordinate("3", "3"));
innerCurve.addPoint(new Coordinate("3", "1"));
polygon.addCurve(innerCurve);
yandexMap.addPolyline(polygon);
yandexMap.addMarker(new Marker(new Coordinate("37.656577", "55.741176")));
yandexMap.addMarker(new Marker(new Coordinate("37.656748", "55.741419"), Style.FLAG));
yandexMap.addMarker(new Marker(new Coordinate("37.655131", "55.741814"), Style.PIN, Type.BLACK));
yandexMap.addMarker(new Marker(new Coordinate("37.658257", "55.742524"), Style.PIN, Type.GRAY));
yandexMap.addMarker(new Marker(new Coordinate("37.660286", "55.743301"), Style.SQUARE, Type.A));
yandexMap.addMarker(new Marker(new Coordinate("37.661831", "55.745165"), Style.SQUARE, Type.B));
yandexMap.addMarker(new Marker(new Coordinate("37.662947", "55.743108"), Style.ROUND, Type.B));
YandexApiUrlBuilder yandexApiUrlBuilder = new YandexApiUrlBuilder();
String url = yandexApiUrlBuilder.build(yandexMap);