Select to view content in your preferred language

How to place pushpin bottom tip at mouse click point?

1230
7
10-27-2010 12:41 PM
AmarYara
Emerging Contributor
All:
I am using push-pin PictureMakerSymbol graphic where user clicks on the map.
The center of the push-pin is co-inciding with the point clicked.
How do I get the bottom tip of the push-pin to co-incide with the click point?
Tags (2)
0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus
amarny,

   PictureMarkerSymbol has a xoffset and yoffset attribute just set them.
0 Kudos
AmarYara
Emerging Contributor
amarny,

   PictureMarkerSymbol has a xoffset and yoffset attribute just set them.


Tried it without success before posting . Any idea on how much x and y offsets should be with push-pin of 35x35.

Thanks
Amar
0 Kudos
AniketWani
Esri Contributor
Tried it without success before posting . Any idea on how much x and y offsets should be with push-pin of 35x35.


Try the below code snippet.

                // PictureMarker - embedded image
                [Embed('asset/i_pushpin.png')]
                var picEmbeddedClass:Class;
                var pictureMarker:PictureMarkerSymbol = new PictureMarkerSymbol(picEmbeddedClass,30,30,-15,15);

                var myGraphicPic:Graphic = new Graphic(event.mapPoint);
                myGraphicPic.symbol = pictureMarker;


I am using i_pushpin.png image . I am resizing image to 30x30 and adding offset of -15, 15.
0 Kudos
AmarYara
Emerging Contributor
Try the below code snippet.

                // PictureMarker - embedded image
                [Embed('asset/i_pushpin.png')]
                var picEmbeddedClass:Class;
                var pictureMarker:PictureMarkerSymbol = new PictureMarkerSymbol(picEmbeddedClass,30,30,-15,15);

                var myGraphicPic:Graphic = new Graphic(event.mapPoint);
                myGraphicPic.symbol = pictureMarker;


I am using i_pushpin.png image . I am resizing image to 30x30 and adding offset of -15, 15.


Hi Aniket:
Constructor new PictureMarkerSymbol(picEmbeddedClass,30,30,-15,15); is not available in Flex 3.  I  modified your code and tried as below but it the graphic is way off from the click point.

                [Embed('asset/i_pushpin.png')]
                var picEmbeddedClass:Class;
                var pictureMarker:PictureMarkerSymbol = new PictureMarkerSymbol(picEmbeddedClass,30,30);
                pictureMarker.xoffset = -15;
                pictureMarker.yoffset = 15;
  
                var grPushpin :Graphic = new Graphic(mapPoint, pictureMarker);
                
               lyrSymbols.add(grPushpin);

lyrSymbols is a GraphicsLayer
                      
Thanks,
Amar
0 Kudos
AniketWani
Esri Contributor

Constructor new PictureMarkerSymbol(picEmbeddedClass,30,30,-15,15); is not available in Flex 3. 


What version of the ArcGIS Flex api are you using? You can find this out in the name of api swc or right click on your application and select menu 'About ArcGIS API for Flex...'
0 Kudos
AmarYara
Emerging Contributor
What version of the ArcGIS Flex api are you using? You can find this out in the name of api swc or right click on your application and select menu 'About ArcGIS API for Flex...'


Currently the project is using agslib-1.1-2009-01-21.swc
I also noticed that I have agslib-1.2-2009-05-15.swc too but is not being used.

Thanks,
Amar
0 Kudos
AmarYara
Emerging Contributor
Currently the project is using agslib-1.1-2009-01-21.swc
I also noticed that I have agslib-1.2-2009-05-15.swc too but is not being used.

Thanks,
Amar


I have update my library to agslib-1.3-2009-10-31.swc and was able to get it to work.
Thanks for all your help Aniket.

Amar
0 Kudos