[Users] Get Position from Vectorlayer

Andreas Hocevar ahocevar at opengeo.org
Mon Nov 21 14:26:09 CET 2011


Hi,

layer.map.getLonLatFromPixel(...);

or

feature.layer.map.getLonLatFromPixel(...);

And instead of feature.lonlat try

feature.getBounds().getCenterLonLat();

Andreas.

On Mon, Nov 21, 2011 at 1:46 PM, Kai Volland <kaivolland at web.de> wrote:
> And, how can i call it on the map and not on the vector layer?
> I also tried feature.lonlat but this is "null" too.
>
>
> Am 21.11.2011 12:34, schrieb Andreas Hocevar:
>>
>> Hi,
>>
>> you should be using the getLonLatFromPixel API method, although this
>> won't fix your issue. To fix your issue, make sure to really call it
>> on the map, not on the vector layer. And finally, it won't return
>> anything before the extent/center of the map has been set initially.
>>
>> Andreas.
>>
>> On Mon, Nov 21, 2011 at 11:58 AM, Kai Volland<kaivolland at web.de>  wrote:
>>>
>>> Hi,
>>>
>>> i get the error map.getLonLatFromViewPortPx is null when using it with a
>>> vectorlayer. Isn't it possible to use it it with a vectorlayer? And if
>>> it's not possible how to get the position of an vector item?
>>>
>>> (The idea is to zoom in when clicking on clustered vectoritems.)
>>>
>>> Kind regards
>>>
>>> Kai
>>> _______________________________________________
>>> Users mailing list
>>> Users at geoext.org
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>>
>>
>>
>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list