Select to view content in your preferred language

Adding Georeferenced Images to the Map

2355
2
02-17-2011 02:19 PM
JasonLevine
Deactivated User
Hello All,
    I've been looking into how you can add georeferenced jpegs to a flex map using their associated world (jgw) files.  Judging by the lack of information out there on this topic, I have a feeling it isn't possible yet.

I've gathered the following parameters on world files:

Line 1: A, pixel size in the x-direction in map units/pixel
Line 2: 😧 rotation about y-axis
Line 3: B: rotation about x-axis
Line 4: E: pixel size in the y-direction in map units, almost always negative[3]
Line 5: C: x-coordinate of the center of the upper left pixel
Line 6: F: y-coordinate of the center of the upper left pixel

I tried adding the image to the map using <mx:image>, but the only properties that I could import form the world file are rotationY (line 2) and rotationX (line 3).

Any ideas on how to do this?  Is it even possible?

Thanks for your help,
Jason
Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Jason,

   You have a long road ahead of you... Here is a starting place:

http://thunderheadxpler.blogspot.com/2009/02/ground-overlays-on-maps.html
0 Kudos
MarthaSelig1
Emerging Contributor
Jason ended up implementing our images as PictureMarkerSymbols, since we had an associated layer of the shapes of the rectified images. We get the geometry from the layer file and then size and position the PictureMarkerSymbol accordingly. The resizing needs to be done after every change in zoom level.

Now, however, we are experiencing what I think is a timing issue related to the file size of the image. Somewhere between 5.5 mb and 6.5 mb, the images do not load. No error is returned but all I can come up with is the asynchronous processing.

I'm looking for implementation suggestions, given that I don't know when the PictureMarkerSymbol is ready. I've tried using CallLater to add them and, since there could be a list of desired images, pushing all of the PictureMarkerSymbols into an array and adding them to the graphics layer after traversing the list. Neither adds the larger files.

If a bit of code will help you visualize the process, here's what I'm currently toying with:

   public function georeference(event:*):void
   {
    georeferenceLayer.clear();
    anchorPoint = map.extent.center;
    var level:Number = map.level;
    var currentResolution:Number = map.lods[level].resolution;
    var widthInPixels:Number = new Number();
    var heightInPixels:Number = new Number();
    var geoImageSymbol:PictureMarkerSymbol = new PictureMarkerSymbol();
    var subdivisionExtent:Extent = new Extent;
    var xOffset:Number = new Number;
    var yOffset:Number = new Number;
    
    if (level > 13)
    {
     imageArray = [];
     for (var k:int = 0; k<subdivisionArray.length; k++)
     {
      if (subdivisionArray.isSelected == true)
      {
       widthInPixels = subdivisionArray.widthInUnits/currentResolution;
       heightInPixels = subdivisionArray.heightInUnits/currentResolution;
       subdivisionExtent = subdivisionArray.subdivisionExtent;
       xOffset = (subdivisionExtent.center.x - map.extent.center.x)/currentResolution;
       yOffset = (subdivisionExtent.center.y - map.extent.center.y)/currentResolution;       
       geoImageSymbol = new PictureMarkerSymbol(PRINT_CENTER+subdivisionArray.filename,widthInPixels,heightInPixels,xOffset,yOffset,0);
       //georeferenceLayer.add(geoImage);
       imageArray.push(geoImageSymbol);
      }
     }
     if (imageArray.length > 0)
     {
      for (k = 0; k<imageArray.length; k++)
      {
       var geoImage:Graphic = new Graphic(anchorPoint,imageArray);
       georeferenceLayer.add(geoImage);
      }
     }     
    }
    else
    {
     Alert.show("Please zoom in closer to view subdivision maps.");     
    }
   }


If timing is my issue, how can I wrap it to get around this problem? I would greatly appreciate any suggestions.

Thanks,
Martha
0 Kudos