Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

am not sure whether this is a stupid question or not.. but I am wondering how to dynamically check whether a layer object belongs to OpenLayers.Layer.Vector class.

Thanks for any replies!

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

Simply test the javascript instanceof operator against OpenLayers.Layer.Vector or Vector

share|improve this answer
add comment

better way: layer.CLASS_NAME == 'OpenLayers.Layer.Vector'

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.