[OpenLayers-Users] OpenLayers.Geometry.LineString Problem

Yasemin YILMAZ yasemin.yilmaz.embedded at gmail.com
Tue Aug 7 04:47:14 PDT 2012


Hi all,

I've drawn a line between two feature markers by using
OpenLayers.Geometry.LineString. A line from outline of a marker to other
has been drawn expectedly if the pen width is 1 as you can see in map1.png.
I want to use a bolder pen. But a line drawing starts from inside of a
marker unexpectedly if the pen width is 2 as you can see in map2.png. In
case 2, the line view turns to normal after I do some zoom out/in. How can
I solve this problem?

            var mPoint1 = new OpenLayers.Geometry.Point(29, 41.060);
            var mPoint2 = new OpenLayers.Geometry.Point(29, 41.100);

            var mFeature1   = new OpenLayers.Feature.Vector(

mPoint1.transform(SRS_LONLAT, SRS_GOOGLE),
                                                            { some: 'data'
},
                                                            {
externalGraphic: 'img/marker.png', graphicHeight: 21, graphicWidth: 16 });

            var mFeature2   = new OpenLayers.Feature.Vector(

mPoint2.transform(SRS_LONLAT, SRS_GOOGLE),
                                                            { some: 'data'
},
                                                            {
externalGraphic: 'img/marker.png', graphicHeight: 21, graphicWidth: 16 });

            mVectorLayer.addFeatures(mFeature1);
            mVectorLayer.addFeatures(mFeature2);

            var mGeometry = new OpenLayers.Geometry.LineString([mPoint1,
mPoint2]);
            var mArtery = new OpenLayers.Feature.Vector(mGeometry, null, {

strokeColor: "red",

strokeOpacity: 1,

strokeWidth: 2

});
            mVectorLayer.addFeatures(mArtery);


Thanks a lot for your helps and explanations,
Yasemin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120807/b912c37e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maps.rar
Type: application/rar
Size: 24723 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120807/b912c37e/attachment-0001.rar>


More information about the Users mailing list