I have implemented this code to create point event layer by xy text file, however I'm wondering how to create a point graphic by xy value?
This script draws point graphic by mouse down. When I steer away from the mouse down event and input my xy values manually it does not draw.
Using the Point class looks like it might also be a solution, however I'm not sure how to implement this code without getting a null reference error on point.setX line.
Dim point As New Point()
point.setX(-100.0)
point.setY(40)
Dim markerElement As New MarkerElement()
markerElement.setGeometry(point)
Dim map As IMap = mxdoc.FocusMap
Map.addElement(markerElement, 0)
Any suggestions on how to create a graphic point by xy value?
Thank You
Answer
In the ArcGIS Resource Center is a discussion about Working with map elements which gives you an example on how to create a Point:
Dim point As IPoint = New PointClass()
point.X = 0
point.Y = 0
Then you can use the AddGraphicToMap snippet to draw the graphic on the map using the supplied colors.
No comments:
Post a Comment