none
Add point into polygon Exactly on selected RRS feed

  • Question

  • I am developing bing map and drawing object like polyline,polygon,rectangle and circle using bing map api.

    I have successfully drawn all these object. Now i want to add new point in any object. Say for example i have drawn polygon on bing map but now i have to add another point in bing map and point should be on line of polygon it should not be inside or outside of polygon. Must be exactly on polygon's Line.

    Say for example.

    I have five line

    1. A-B

    2. B-C

    3. C-D

    4. C-E

    5. E-A

    If i clicked on A-B than point should be added between A-B else it should not be. Can any one help me how can i do that? Thanks isn advance.


    Thanks & Regards Hemant Yadav Sr. Software Engineer
    • Moved by Ricky_Brundritt Friday, March 9, 2012 1:49 PM (From:Bing Maps: Map Control and Web services Development)
    Wednesday, January 5, 2011 7:23 AM

Answers

    • Create invisible polylines using the polygon locations
    • Use the Click event on the polyline
    • Click event will get fired only when some one clicks exactly on the polyline (which is also a side of polygon)
    • Get the click location thru eventargs and  that way you can add a point exactly on the polygon which is visible.

    Im not sure how many polygons you are displaying on the map at a time. If you have lots of them, then you should look into optimizing the display of polygons (dynamic rendering - displaying polygons with in the view extent etc) to make this approach work.

    Hope this helps.


    Aditya Tadakaluru MCPD, MCITP, MCTS(Bing Maps)
    • Marked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    • Unmarked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    • Marked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    Wednesday, January 5, 2011 4:34 PM
  • I have finally manage to get closer and its started working. Have little issue but manage to get it working....

    Thanks

     


    Thanks & Regards Hemant Yadav Sr. Software Engineer
    • Marked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    Friday, January 7, 2011 12:07 PM

All replies

    • Create invisible polylines using the polygon locations
    • Use the Click event on the polyline
    • Click event will get fired only when some one clicks exactly on the polyline (which is also a side of polygon)
    • Get the click location thru eventargs and  that way you can add a point exactly on the polygon which is visible.

    Im not sure how many polygons you are displaying on the map at a time. If you have lots of them, then you should look into optimizing the display of polygons (dynamic rendering - displaying polygons with in the view extent etc) to make this approach work.

    Hope this helps.


    Aditya Tadakaluru MCPD, MCITP, MCTS(Bing Maps)
    • Marked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    • Unmarked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    • Marked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    Wednesday, January 5, 2011 4:34 PM
  • Another common approach is to automatically define "ghost" vertices midway along each existing edge of the polygon.

    You then click and drag on these "ghost" vertices to add them to the shape, progressively making it more detailed. There used to be a good demo of this at spatialwiki.com, but the site appears to be down. See if you can work out what I mean from this diagram!:


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Wednesday, January 5, 2011 5:26 PM
    Moderator
    • Create invisible polylines using the polygon locations
    • Use the Click event on the polyline
    • Click event will get fired only when some one clicks exactly on the polyline (which is also a side of polygon)
    • Get the click location thru eventargs and  that way you can add a point exactly on the polygon which is visible.

    Im not sure how many polygons you are displaying on the map at a time. If you have lots of them, then you should look into optimizing the display of polygons (dynamic rendering - displaying polygons with in the view extent etc) to make this approach work.

    Hope this helps.


    Aditya Tadakaluru MCPD, MCITP, MCTS(Bing Maps)

    Hi Aditya,

    Thanks for you reply.

    I am displaying one object at a time i have already does which you have mention in your post. I am getting object when i clicked on polygon i can know that i have clicked on polygon but i want exactly on line.

    As i have mention in my post.

    Can you post example how can i do that?

    Thanks 


    Thanks & Regards Hemant Yadav Sr. Software Engineer
    Thursday, January 6, 2011 4:56 AM
  • Hello Tanoshimi,

    Can you send me some example of of it as you mention in diagram. I Checked it we can do that easily with google map but how to do that in bing map?


    Thanks & Regards Hemant Yadav Sr. Software Engineer
    Thursday, January 6, 2011 4:58 AM
  • I have finally manage to get closer and its started working. Have little issue but manage to get it working....

    Thanks

     


    Thanks & Regards Hemant Yadav Sr. Software Engineer
    • Marked as answer by Hemant Yadav Friday, January 7, 2011 12:07 PM
    Friday, January 7, 2011 12:07 PM