How to display small bitmaps as overlays?
I need to display images as overlays, where their bounding box is tied to specific coordinates.
How can this be done ?
How can this be done ?
2
people have this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?If your image is in the same projection as your map, then...
Listen for zoom, pan and extent change events. Position your image using the top left location and the result of map.locationPoint. Scale your image using the ratio between the the projected side length and the original side length.
Off the top of my head (this code hasn't been compiled or tested) it would look something like:
// when you've loaded the image, before scaling it
var originalWidth:Number = img.width;
var originalHeight:Number = img.height;
var topLeftLocation:Location = new Location(...);
var bottomRightLocation:Location = new Location(...);
// then in map events ...
var topLeft:Point = map.locationPoint(topLeftLocation);
var bottomRight:Point = map.locationPoint(bottomRightLocation);
img.x = topLeft.x;
img.y = topLeft.y;
image.scaleX = (bottomRight.x - topLeft.x) / originalWidth;
image.scaleY = (bottomRight.y - topLeft.y) / originalHeight;
You can add the img as a child of Map directly, or you can make a separate Sprite or MovieClip to contain multiple image overlays.
Hope that helps!
I’m unsure
1 person says
this answers the question
-
In my haste to crank out an answer, I mixed up some img/image references. It should probably be image throughout - find and replace at will! -
This comment was removed on 07/16/09.
see the change log -
Thanks! -
Inappropriate?I'm trying to implement something like that (image overlay). I know google call it GroundOverlay. Is there someone that has a class that works fine with the TweenMap? Thank you!
-
Inappropriate?I'm interested too. I hope to have time in the next days to start working on that :)
-
Inappropriate?Any progress on this? I'm trying to load image from WMS service with pixel coordination.
Loading Profile...



EMPLOYEE
