Is there a way to substr a value returned by toShortString()?

Posted by Jym Khana on Stack Overflow See other posts from Stack Overflow or by Jym Khana
Published on 2010-03-19T18:55:36Z Indexed on 2010/03/19 19:11 UTC
Read the original article Hit count: 91

Filed under:
|

I am working with openlayers and I can get a point on a map but I can't get the individual coords. feat = drawLayer.features[0];

       var geom = feat.geometry;
       var loca = geom.toShortString();
       var long = loc.substr(0,9);

       alert(geom.toShortString());//returns the correct coords in xx.xxx,xx.xxx format
       alert(loca);//returns 2 very large numbers in xx.xxx,xx.xxx format
       alert(long);//returns the first, incorrect number

What exaclty am I doing wrong and how can I correct it?

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about openlayers