[OpenLayers-Users] Place Point at x% y% to an no geographic Layer.TileCache possible?

Jimmy Aumard jimmy.aumard at gmail.com
Fri Apr 23 09:29:16 EDT 2010


Hello,

I have no geographic tiles show with OpenLayers.Layer.TileCache and I would
like to put a Point(feature) at 50% x and 50% y for example

I have test this :

var zoom = map.getZoom();
var size = zoomDim[zoom]; // Size of my big image by zoom
    var x = 50 * size[1] / 100; // give me the  x pixel from my image
    var y = 50 * size[0] / 100; //give me the y pixel from my image
    var pixel = map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(x,y)); //
I have try this to get a correct pixel
    var coord = map.getLonLatFromPixel(pixel);

    vector.removeFeatures(vector.features);
    var point = new OpenLayers.Geometry.Point(coord.lon, coord.lat);
    vector.addFeatures( [ new OpenLayers.Feature.Vector(point.clone()) ]);

It's not work  my Point is not on the image. I don't know how can I find a
lonlat corresponding to my pixel or more simply how can use openlayers with
no projection with just pixel because my data is not geographic

Thanks

Cheers

-- 
Aumard Jimmy
Développeur

KINAXIA
c/o CICA / PacaEst
2229 Route des Crêtes
F-06560 Sophia Antipolis

Tél.: +33 (0)4 8973 0242
Mob.: +33 (0)6 6017 2827
Fax : +33 (0)4 8307 6583

http://www.kinaxia.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100423/fdaf187b/attachment.html


More information about the Users mailing list