i’ve come up with an idea that has a mask effects in google maps so that it can highlight a city .but i’ve searched the internet again and again found no document about this.
so ,is it possible to make mask effects in android or ios just like the effets below? and how to?
http://cadgis-blog.blogspot.com/2011/10/google-maps-create-cool-mask-effect-on.html
So there’s two problems there. The first is where to get the boundary data from, and the second is how do you draw it on a map.
Answering the second part first, if you’re using the iOS map view (
MKMapView): you’ll want to look intoMKPolygonView. You can definitely highlight an arbitrary polygon, but the usual highlighting effect looks like a coloured overlay inside the polygon.The thing to do, therefore, would be to make a huge polygon that encompasses the entire country, with your region as a hole in the polygon. That is, I believe, what your demo does. You can make an
MKPolygonwith thepolygonWithPoints:count:interiorPolygons:method, and pass in your ‘hole’ as an interior polygon to be cut out.Regarding the first part, how to get the data: what you need is a set of latitude/longitude pairs that make up the border for your region. Your example used this dataset, which is administrative borders for Switzerland. You’ll need to find yourself a dataset that encompasses the borders for cities in the country you’re interested in. I would imagine that you would store the coordinates of the borders in a database embedded in your app.