Using Sprites for Placemark icons

205 views
Skip to first unread message

Nymor

unread,
Jun 23, 2010, 3:06:45 AM6/23/10
to KML Developer Support - Google Earth Plug-in
Hi,

(I suspect the answer to this is no(?) but thought I'd double-check.)

Is it possible to base icons on image sprites for Placemarks as is
possible for Marker icons in the Maps API?. I appreciate that KML
can't do it but was wondering if it's possible when creating
Placemarks from scratch in javascript.

I have situations where I load alot of different icons (~100) and
that's alot of individual network round trips and when doing the same
in Maps I can just load one sprite image for the lot.

If not I feel a feature request coming on...

Thanks
Nymor

Nymor

unread,
Jul 8, 2010, 6:50:36 PM7/8/10
to KML Developer Support - Google Earth Plug-in
Hi,

I'll take that as a no so new feature request filed at
http://code.google.com/p/earth-api-samples/issues/detail?id=493

Nymor

fraser (Earth API Guru)

unread,
Jul 8, 2010, 9:05:30 PM7/8/10
to KML Developer Support - Google Earth Plug-in
Hi Nymor,

I don't know a great deal about the maps api so shoot me down if this
is totally off the mark.
Could you not implement the functionality of the sprites in the maps
api into the earth api?
I am thinking along the lines of how the maps-to-earth functionality
is supported when geocoding for example.

Anyhow, just a thought....

F.

On Jul 8, 11:50 pm, Nymor wrote:
> Hi,
>
> I'll take that as a no so new feature request filed athttp://code.google.com/p/earth-api-samples/issues/detail?id=493

Nymor

unread,
Jul 9, 2010, 1:49:41 AM7/9/10
to KML Developer Support - Google Earth Plug-in
Hi Fraser,

To be honest I'm not sure - I'm new to Maps myself.

Creating an icon in Maps using the sprite technique looks something
like:-

var iconImage = new google.maps.MarkerImage(
"mySpriteSheet.png", // icon sprite sheet
new google.maps.Size(32, 32), // Icon size
new google.maps.Point(32, 64), // Origin -
position in sprite sheet
new google.maps.Point(16, 16) // Anchor point
);

It seems very "maps" orientated. However I understand, I think, what
you mean - for example if a Marker was created in Maps and then the
view was changed to Earth would the Marker show in the Earth view or
would you have to recreate it with the Earth API? While I am coding
for both Earth and Maps in my app I'm doing them separately (you
either have Earth installed or it drops back to a Maps version) so I
don't switch to Earth from within Maps and therefore don't know what
carries over automatically between the views.

Thanks for the suggestion though - if anyone who may have done this
could comment I'm all ears.

Regards
Nymor

fraser (Earth API Guru)

unread,
Jul 9, 2010, 10:37:19 AM7/9/10
to KML Developer Support - Google Earth Plug-in
Hi,


That is it exactly, use the maps api and add the sprites exactly as
you would ala-maps. The markers should show as place-marks just as you
want when in earth view. If I get some time I might have a play with
this myself as I would be interested to see if it works too.

F.

StarTraX

unread,
Nov 2, 2012, 5:50:17 PM11/2/12
to google-earth-...@googlegroups.com
I know this is a pretty old thread, but It's exactly the topic I'm struggling with right now. google.maps.MarhkerImage  does it so elegantly with MarkerImage. 
Did you have any success in using a sprite map to generate icons in geplugin? 

StarTraX

unread,
Nov 4, 2012, 10:00:27 PM11/4/12
to google-earth-...@googlegroups.com
Here's the way I have approached the challenge of using the contents of a CSS sprite map as Placemark Icon images in GEPlugin.
I used PHP's "GD and Image" functions to cut out the piece of the sprite map image I want for the Placemark, defined using $_GET params,  and send it back as a GIF. The PHP script sends back the gif image with
header('Content-Type: image/gif');
imagegif($dest);
I put the URL of the php script in the Icon href
Works like a charm, and, surprisingly quickly to generate 100 placemark icons.

Patrick Tucker

unread,
Nov 5, 2012, 4:35:37 PM11/5/12
to google-earth-...@googlegroups.com
If you look at issue 493, linked above, the response says that you can use KmlIcon to accomplish what you are trying to do.
Reply all
Reply to author
Forward
0 new messages