Restrictions of static maps?

60 views
Skip to first unread message

Arjan

unread,
Aug 20, 2011, 3:55:42 PM8/20/11
to Google Maps JavaScript API v3
Hi!

Yesterday, I found out that Google Static Maps allows me to construct
a very basic map with a few lines on it. It was very convenient that I
could get instant result. Today, I tried an example with 8 lines and
my webbrowser gave an error: to long URL! It appeared that I had used
too many characters. Reducing the representation of the numbers
helped.

--> question: where can I find the possibilities/features and
limitations of static map production?

--> next question: If I want to construct slightly more intricate maps
than possible with static maps: where can I find examples to use as a
first test to start my own application?

Background: I just want to be able to enter a location and then add
"sector plots": for a given radius add octants around it in
transparent colours. Maybe add a simple legend.

Thanks!


Arjan

Chris Broadfoot

unread,
Aug 21, 2011, 9:42:30 PM8/21/11
to google-map...@googlegroups.com
Hi Arjan,

As you found, the Static Maps API is subject to restrictions in the *browser* regarding URL length. This does limit the complexity of maps you can generate.

See here:
"Static Map URLs are restricted to 2048 characters in size."

If you need more complex maps I'd start looking at the V3 API:

Read the basics:

And go through the tutorial:

... and then post back here when you get stuck!

Cheers
Chris


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Arjan

unread,
Aug 23, 2011, 7:18:52 AM8/23/11
to Google Maps JavaScript API v3
> If you need more complex maps I'd start looking at the V3 API:http://code.google.com/apis/maps/documentation/javascript/
> Read the basics:http://code.google.com/apis/maps/documentation/javascript/basics.html
> And go through the tutorial:http://code.google.com/apis/maps/documentation/javascript/tutorial.html
> ... and then post back here when you get stuck!


Okay, thanks, I'll plough through these references!

A.

Arjan

unread,
Aug 23, 2011, 2:18:29 PM8/23/11
to Google Maps JavaScript API v3
Hi!

I constructed a simple sample sector plot:

http://arjan64.home.xs4all.nl/test2.html

It does more or less what I had with static maps, but now hopefully
without the restriction of 2048 characters. Of course, now I have some
questions:

1): With the static maps, the zoom was set automatically such that
alle elements would fit. Now I had to specify the zoom explicitly
inthe code. Can I enable automatic map scaling with V3 API?

2): Is there a way to lock zooming? Once everything fits, I would
prefer the zoom-level to remain fixed. Now, every time I touch the
mouse wheel, or (try to) drag the map, the map changes.

3): The sequence to draw a rectangle should in fact draw a segment of
a circle. For a given central point, I would like to have a routine
that draws such a sector for a specified radius from a given starting
angle to a given end-angle. My fluency in "JavaScript" is poor, and I
find this language quite different from the one's I use to use:
FORTRAN and PASCAL. Can someone give me a hint on how to write such a
subroutine? Now I wrote it all out for each sector separately, knowing
that this is tedious if I have 6 sectors.

4): Is there a way to enter the location of the central point and have
the map use that?

5): Can I add text on the map? E.g.: usually, there are 8 sectors and
I would like
to add the sector numbers.

Thanks!

Arjan

Arjan

unread,
Aug 23, 2011, 2:26:12 PM8/23/11
to Google Maps JavaScript API v3
> 2): Is there a way to lock zooming? Once everything fits, I would
> prefer the zoom-level to remain fixed. Now, every time I touch the
> mouse wheel, or (try to) drag the map, the map changes.


Okay, this one was simple. Sorry for asking:

var myOptions = {
[...]
disableDefaultUI: true,
disableDoubleClickZoom: true,
draggable: false,
scrollwheel: false,
zoomControl: false,
[...]
}

Now the rest!

A.

geoco...@gmail.com

unread,
Aug 23, 2011, 2:53:55 PM8/23/11
to Google Maps JavaScript API v3
On Aug 23, 11:18 am, Arjan <arjan.van.d...@rivm.nl> wrote:
> Hi!
>
> I constructed a simple sample sector plot:
>
> http://arjan64.home.xs4all.nl/test2.html
>
> It does more or less what I had with static maps, but now hopefully
> without the restriction of 2048 characters. Of course, now I have some
> questions:
>
> 1): With the static maps, the zoom was set automatically such that
> alle elements would fit. Now I had to specify the zoom explicitly
> inthe code. Can I enable automatic map scaling with V3 API?

You can have it fit the map to the bounds of the objects displayed.

Create an empty LatLngBounds object, call the .extend method with
every point you display on your map (vertices of the polygons as
well), then call map.fitBounds with that LatLngBounds.

>
> 2): Is there a way to lock zooming? Once everything fits, I would
> prefer the zoom-level to remain fixed. Now, every time I touch the
> mouse wheel, or (try to) drag the map, the map changes.

If you want. That

>
> 3): The sequence to draw a rectangle should in fact draw a segment of
> a circle. For a given central point, I would like to have a routine
> that draws such a sector for a specified radius from a given starting
> angle to a given end-angle. My fluency in "JavaScript" is poor, and I
> find this language quite different from the one's I use to use:
> FORTRAN and PASCAL. Can someone give me a hint on how to write such a
> subroutine? Now I wrote it all out for each sector separately, knowing
> that this is tedious if I have 6 sectors.

Does this search help:
http://groups.google.com/group/google-maps-js-api-v3/search?group=google-maps-js-api-v3&q=sector+map&qt_g=Search+this+group

The first result looks useful:
http://groups.google.com/group/google-maps-js-api-v3/browse_frm/thread/ece74d5461b9d0e1/c208cad4af4c6614?lnk=gst&q=sector+map#c208cad4af4c6614


>
> 4): Is there a way to enter the location of the central point and have
> the map use that?
>
> 5): Can I add text on the map? E.g.: usually, there are 8 sectors and
> I would like to add the sector numbers.

Yes. See the InfoBox third party library.

-- Larry

>
> Thanks!
>
> Arjan

Arjan

unread,
Aug 23, 2011, 3:04:46 PM8/23/11
to Google Maps JavaScript API v3
Interesting links!
I'll study it with red ears!
Thanks,

Arjan
Reply all
Reply to author
Forward
0 new messages