[OpenLayers-Users] 回复: Users Digest, Vol 105, Issue 1

yjphhw at sohu.com yjphhw at sohu.com
Sat Jun 6 04:30:24 PDT 2015


you should acquire map objects.getPixelFromCoordinate is a method that map objects hold.var pixel = map.getPixelFromCoordinate(coordinateFirstClub);console.log(pixel); // Return nullmy pleasure ----- 原文 ----- 发件人: openlayers-users-request at lists.osgeo.org 主 题: Users Digest, Vol 105, Issue 1时 间: 2015年6月3日  上午3:01:03Send Users mailing list submissions to	openlayers-users at lists.osgeo.orgTo subscribe or unsubscribe via the World Wide Web, visit	http://lists.osgeo.org/mailman/listinfo/openlayers-usersor, via email, send a message with subject or body 'help' to	openlayers-users-request at lists.osgeo.orgYou can reach the person managing the list at	openlayers-users-owner at lists.osgeo.orgWhen replying, please edit your Subject line so it is more specificthan "Re: Contents of Users digest..."Today's Topics:   1. getPixelFromCoordinate method in OL3? (pascal)----------------------------------------------------------------------Message: 1Date: Tue, 2 Jun 2015 05:59:05 -0700 (PDT)From: pascal <pascal2833 at gmail.com>To: openlayers-users at lists.osgeo.orgSubject: [OpenLayers-Users] getPixelFromCoordinate method in OL3?Message-ID: <1433249945244-5208665.post at n6.nabble.com>Content-Type: text/plain; charset=us-asciiHi, I'm trying to retrieve pixel coordinates from long/lat coordinate to draw ina canvas element using this way:var geometryFirstClub = clubFeatures[0].getGeometry(); // clubFeatures is anarray of circlesvar coordinateFirstClub = geometryFirstClub.getCenter();  console.log(coordinateFirstClub); // Return Array [ 7, 43.33 ] var pixel = getPixelFromCoordinate(coordinateFirstClub);console.log(pixel); // Return nullSo, I don't understand why I have "null" in console.log response.What's wrong?Thanks a lot, Pascal.--View this message in context: http://osgeo-org.1560.x6.nabble.com/getPixelFromCoordinate-method-in-OL3-tp5208665.htmlSent from the OpenLayers Users mailing list archive at Nabble.com.------------------------------_______________________________________________Users mailing listUsers at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/openlayers-usersEnd of Users Digest, Vol 105, Issue 1*************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20150606/5151b99e/attachment.html>


More information about the Users mailing list