0

I am making an app using google map at some point I need to download static map .

Currently i am sending to static map the center(Location) and zoom that I need , is it possible to send static map 4 location which will be the borders of the static map instead of zoom value and location?

it its really important to me because I do not want to add to static map locations that i do not want in my map, since I am doing pixel job with the static map any help will be appreciated.

Thanks.

yonikohen
  • 11
  • 6

1 Answers1

0

There is no specific way to do this directly in the google static maps API. However, you can trick google into doing this by creating a path.

https://developers.google.com/maps/documentation/static-maps/intro?hl=en#ImplicitPositioning

Normally, you need to specify center and zoom URL parameters to define the location and zoom level of your generated map. However, if you supply markers, path, or visible parameters, you can instead let the Google Static Maps API determine the correct center and zoom level implicitly, based on evaluation of the position of these elements.

You don't need to give it 4 points, just 2 corners opposite each other such as (top right and bottom left), or (top left and bottom right). The path can have transparency so that it won't be seen on the static map.

Tah
  • 1,526
  • 14
  • 22
  • heres an example of me trying this out and its not working please help http://maps.google.com/maps/api/staticmap?path=color:0x0000ff|35.086422,33.134577|35.136422,33.084577&size=640x640 – yonikohen Dec 18 '15 at 01:16
  • I'm not quite sure what your problem is. The image looks as close as it can get. Keep in mind, the static maps returns a tile and isn't as dynamic as using the full maps API. Or are you having problems with making the line transparent? – Tah Dec 18 '15 at 02:15
  • i need to give static map its location borders , like if i give it 4 locations i want it to present what is between this 4 location nothing more . – yonikohen Dec 18 '15 at 02:39
  • That doesn't seem to be possible in the current static maps. How do you plan on using the image? Could you crop the image that's being returned to your liking? – Tah Dec 18 '15 at 02:46
  • For example: here's how you could do it using CSS and html https://jsfiddle.net/hhsk5y81/1/ – Tah Dec 18 '15 at 02:54
  • donot have enought knewledge for css , i am trying to check if 3000* points are sea or land ,that why i need matrix so i wouldnot change any values for those 3000 points – yonikohen Dec 18 '15 at 16:25
  • If you just need to see if the point is in the sea or on land, use reverse geocoding. See this question http://stackoverflow.com/questions/3645649/i-need-to-know-the-predefined-point-is-in-the-sea-or-on-the-land – Tah Dec 18 '15 at 16:41
  • this service has limit per requesting, i am making a navigating app which the matrix of mine change by location of the user so this api is not good for me , only static map solve this. – yonikohen Dec 18 '15 at 18:15
  • Why not just use the full Android-API for the maps then? you can then set the bounding-box on your MapFragment. – Tah Dec 18 '15 at 18:40
  • i do use this , my sailor is navigating with google map on the app, but why i use static is only for disquilfy points which is on the land , what i am basically doing is pixel work , i have shoreline cordinates of israel , and i am checking the line which distance of the shoreline like 250m , basically i have alot of points some on land and some on sea , and i wanna get only the sea ones using static map i can detect them. – yonikohen Dec 19 '15 at 15:00
  • I'm not quite sure I understand what you mean by "pixel work". Are you doing something to detect if the point is on water by the color of the image you're returning? – Tah Dec 20 '15 at 07:21