If one searches for a city on Google Maps, for example Berlin, the municipal boundaries of Berlin (gray dashed line with pink thick line inside) are shown.
Is it possible to make the same with Google Maps API?
If one searches for a city on Google Maps, for example Berlin, the municipal boundaries of Berlin (gray dashed line with pink thick line inside) are shown.
Is it possible to make the same with Google Maps API?
I think you want to put an outline on the map that defines an area, in your case the municipal area of Berlin.
I know in the United States there is Census data that has the longitude and latitudes of all of the counties that are available for download for free. I am not sure if Germany has something similar however a Google search for "long lat coordinates outline Berlin municipal" reveals lots of results.
So what do you do with the coordinates after you find them - Google Maps API allows you put Polygons on the map based on geo-coordinates.
I use the Google Encoded Polylines part of the Geometry library to store my polygons and then redisplay them when a specific state is being displayed.
Example
var map = new google.maps.Map(document.getElementById("googlemap"), myOptions);
var encodedpoints = "<encoded points string>";
var polyOptions = {
"strokeColor": '#000000',
"strokeOpacity": 1,
"strokeWeight": 1,
"fillColor": "#000000",
"fillOpacity": 0.5
};
polyOptions.path = google.maps.geometry.encoding.decodePath(encodedpoints)
var mypolygon = new google.maps.Polygon(polyOptions);
mypolygon.setMap(map);
This example will put a polygon on the map that has a black line border and 50% opacity black fill. You can change the options to whatever you want.
I think it is, but the logic could possibly be quite insane. You can add a view into the MapView and by using Mapview's layoutparams, you can specify a geographical longitude and latitude.
This is one of my "nuclear approaches". I think the MapView object itself can tell you how wide and tall the mapview object is. Once the stuff draws on-screen, you can measure the mapview itself. From here, you have the ability to translate the pixels to longitude and latitude and back. You, from here, can feed all sorts of data to a view to do drawing.
Now, to do something like to get a perfect outline of a graphic on the map probably would have to get to a lower level and do pixel comparisons.
The other alternative is to figure out how to trace the outline of the area and then render that.