[OpenLayers-Users] Place Point at x% y% to an no
geographicLayer.TileCache possible?
Arnd Wippermann
arnd.wippermann at web.de
Fri Apr 23 16:31:33 EDT 2010
Hi,
i cann't help you with your problem, but perhaps the below gives you some
idea how to resolve it.
In OL a map has always a projection. If you not declare a projection, then
OL choose by default EPSG:4326 with maxExtent [-180, -90, 180, 90].
In your case you want only a mathematical xy plane. I use in this case
EPSG:900913 as projection for the map. So I have a large xy plane to work
on.
map = new OpenLayers.Map('map',
{ maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
numZoomLevels: 22,
//maxResolution: 156543.0399,
maxResolution: 200000.0,
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
theme : "theme/default/style.css",
controls:[]
});
The above map options are from
http://gis.ibbeck.de/ginfo/apps/pentominoes/pentominoes.html.
As you can see, this has nothing to do with projection. Nevertheless you
have one to choose, when you use OL for your project.
Arnd
_____
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Jimmy Aumard
Gesendet: Freitag, 23. April 2010 15:29
An: users
Betreff: [OpenLayers-Users] Place Point at x% y% to an no
geographicLayer.TileCache possible?
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/1a607af2/attachment.html
More information about the Users
mailing list