AW: [OpenLayers-Users] how to change the size of OpenLayers.Layer.Image

Arnd Wippermann arnd.wippermann at web.de
Tue Aug 30 16:35:31 EDT 2011


No,

Instead of a point as vector feature, you can use an externalGraphic to show
the point. You can change the width, the height and you can rotate the
externalGraphic, but it's not possible to distort the image. The image is
always a rectangle.

Two example to show what is possible with point features and
externalGraphic:
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL27/examples/ExternalGraphicOver
lay/ExternalGraphicOverlay.asp
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL29/Stahlrohr/Stahlrohr.asp 

Regards,
Arnd

-----Ursprüngliche Nachricht-----
Von: JK Chen [mailto:jk.chen at sdl.usu.edu] 
Gesendet: Dienstag, 30. August 2011 19:28
An: arnd.wippermann at web.de
Cc: users at openlayers.org
Betreff: RE: [OpenLayers-Users] how to change the size of
OpenLayers.Layer.Image

Arnd, 

Did you mean I can display image right inside polygon? I attached the
screenshot here that shows my polygons.

Each of these polygons represents the four corners of sensed images from
devices of aircrafts.

Thanks.

JK

-----Original Message-----
From: arnd.wippermann at web.de [mailto:arnd.wippermann at web.de]
Sent: Monday, August 29, 2011 1:21 PM
To: JK Chen
Cc: users at openlayers.org
Subject: AW: [OpenLayers-Users] how to change the size of
OpenLayers.Layer.Image

Hi,

new OpenLayers.Bounds(-118.354,32.834, -118.383, 32.819) should be new
OpenLayers.Bounds(left, bottom, right, top)

but

-118.354 > -118.383
  32.834 >   32.819

try
new OpenLayers.Bounds(-118.383, 32.819, -118.354,32.834)

Openlayers can't display rotated images as Layer.Image. If you want to
display rotated images, you can use as workaround a vector layer with point
feature and externalGraphic.

Good Luck
Arnd

-----Ursprüngliche Nachricht-----
Von: JK Chen [mailto:jk.chen at sdl.usu.edu]
Gesendet: Montag, 29. August 2011 18:16
An: arnd.wippermann at web.de; users at openlayers.org
Betreff: RE: [OpenLayers-Users] how to change the size of
OpenLayers.Layer.Image

Well, it is not working for me. 

My image is not up-right rectangle. Mine are skewed rectangles. 

1. The BBOX for OpenLayers.Image does not have a way to specify that,
Please, OL folks can you confirm that?
2. If I put in the two values of bottom left and top right, my image will
not load.
3. If I specify (-180, -90, 180, 90) for BBox, my image will load. But as
you know, it is not correct. In terms of aspect ratio.

Here is my image, it's four corners, and my OL code. My image is NITF
military image, I have converted to JPEG listed in this email.

Thanks.

-- ol code -- 
    map = new OpenLayers.Map('map_element', {});
    var image_layer = new OpenLayers.Layer.Image(
      'Wallpaper',
      'http://localhost:8080/198/lynx2003050817522799.ntf.jpg',
 
//'http://localhost:8080/187/31AUG939Z0000002ZX000013ZZ0000004DB89A19.ntf.jp
g', 
      //'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
      //new OpenLayers.Bounds(-180,-90,180,90),  // this will display the
image, but of course it's not right in aspect ratio
      new OpenLayers.Bounds(-118.354,32.834, -118.383, 32.819),  // these
values are "correct", but the image will NOT load
      new OpenLayers.Size(0,0),
      {numZoomLevels:10, maxResolution:.625}
     );

--- the four corners

Corner Coordinates:
Upper Left  (-118.3786921,  32.8152343) (118d22'43.29"W, 32d48'54.84"N)
Lower Left  (-118.3537928,  32.8343191) (118d21'13.65"W, 32d50'3.55"N) Upper
Right (-118.3825927,  32.8188274) (118d22'57.33"W, 32d49'7.78"N) Lower Right
(-118.3576934,  32.8379122) (118d21'27.70"W, 32d50'16.48"N)
Center      (-118.3681927,  32.8265733) (118d22'5.49"W, 32d49'35.66"N)

--- my image (nitf) display in OpenEV
--  my image file (jpeg)
JK

-----Original Message-----
From: JK Chen
Sent: Monday, August 29, 2011 8:00 AM
To: 'arnd.wippermann at web.de'
Cc: users at openlayers.org
Subject: RE: [OpenLayers-Users] how to change the size of
OpenLayers.Layer.Image

Very good. Thanks.
BTW, the example says the size value has no effect. Perfect for me.

Regards.

-----Original Message-----
From: arnd.wippermann at web.de [mailto:arnd.wippermann at web.de]
Sent: Thursday, August 25, 2011 12:38 PM
To: JK Chen
Cc: users at openlayers.org
Subject: AW: [OpenLayers-Users] how to change the size of
OpenLayers.Layer.Image

Hi,

You have to know the width and height in map units and the insert point for
your image.

Say x0,y0 und w,h im map units, then

imgLayer.extent=new OpenLayers.Bounds(x0,y0,x0+w,y0+h);

Here you can see, how it works:
http://gis.ibbeck.de/OLClient/examples/ArcGIS93Rest.html
 
Regards,
Arnd


-----Ursprüngliche Nachricht-----
Von: JK Chen [mailto:jk.chen at sdl.usu.edu]
Gesendet: Donnerstag, 25. August 2011 16:23
An: arnd.wippermann at web.de
Cc: users at openlayers.org
Betreff: RE: [OpenLayers-Users] how to change the size of
OpenLayers.Layer.Image

Suppose my image is w and h, how I code? Into extent? Why?

-----Original Message-----
From: arnd.wippermann at web.de [mailto:arnd.wippermann at web.de]
Sent: Wednesday, August 24, 2011 6:20 PM
To: JK Chen
Cc: users at openlayers.org
Subject: AW: [OpenLayers-Users] how to change the size of
OpenLayers.Layer.Image

Hi,

Try to set a new extent for the layer:

imgLayer.extent=new OpenLayers.Bounds(-70,-10,70,10);

This is perhaps needed to refresh the layer imgLayer.setVisibility(false);
imgLayer.setVisibility(true);
 
Arnd

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von jk
Gesendet: Mittwoch, 24. August 2011 21:27
An: users at openlayers.org
Betreff: [OpenLayers-Users] how to change the size of OpenLayers.Layer.Image

Hi,

I am trying to use OL to view military images, jpeg, of various dimensions.
I need to maintain the orginal aspect. Now, how to specify the size values
when creating a new Layer.Image?

Is it possible to change those values after image loads?

How?

Thanks.

JK

--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/how-to-change-the-size-of-OpenLayers-
Layer-Image-tp6721664p6721664.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users





More information about the Users mailing list