NEWBIE Help with VBA Form to add features to an existing point shapefile.

846
7
05-01-2014 11:41 AM
bobcollins
New Contributor
Sorry if this is a stupid question or posted somewhere already.

I want to use a VBA form to add point features to an existing point shape file. I have seen bits and pieces but not enough to give me a good start. I found an example in C# but I am too stupid to figure out what I need. Please someone help me out here.

PS I am employed at a Naval Bombing Range and am using Arcmap to track all of our ordnance dropped and want to use the form to enter in mission information and have this tied to ordnance drop data that I already am able to import using model builder.

Bob
0 Kudos
7 Replies
LeoDonahue
Occasional Contributor III
Hi Bob,

So you want to use the form to add the point?  Does your form contain something like a lat/long text box and you want to enter that text in the form and translate that to a point in the point shapefile?  I'm assuming your shapefile has a WGS 84 type of projection?  How do you handle typos in the form?

Can you post the link to the C# example and maybe we can help translate.

I don't know your workflow, but sometimes people create a tool that lets the user interact with the map, and when the click event happens to place the point, a form will appear to enter the other non-spatial attribute data.  Much like the way ArcMap does point editing.
0 Kudos
bobcollins
New Contributor
Yes I want to be able to add points to an existing shape file from a VBA form. Yes it is WGS84. Not trying to trigger on an event, I simply added a macro to my toolbar and when I press it the form pops up. From this form I simply want to be able to add a point feature and fill in some attributes. I havent got as far as error checking and am assuming coordinates are correct. Just looking for a very basic start here.


Hi Bob,

So you want to use the form to add the point?  Does your form contain something like a lat/long text box and you want to enter that text in the form and translate that to a point in the point shapefile?  I'm assuming your shapefile has a WGS 84 type of projection?  How do you handle typos in the form?

Can you post the link to the C# example and maybe we can help translate.

I don't know your workflow, but sometimes people create a tool that lets the user interact with the map, and when the click event happens to place the point, a form will appear to enter the other non-spatial attribute data.  Much like the way ArcMap does point editing.
0 Kudos
bobcollins
New Contributor
Maybe I am going about this the wrong way. Here is what i am trying to acomplish.

I have a workflow which imports a CSV file from our bomb drop scoring system of the drops for a particular mission (usually 10-50 points with various attributes like pilot name, aim point, miss distance,etc). The resulting xy event layer displays nicely on a background image of our range which I export to send to the squadron so they can see how well they did (drops plotted on target image). In the workflow I also copy these rows to an ever growing archive of bomb drops.

I want the user (guys that score the mission and import the CSV) to be able to add mission data that does not come in the CSV file simply by pressing a toolbar button and entering in the mission data on a VBA form. I want this mission data to somehow be tied to all the bomb drop points that were imported in the CSV file for that mission.

My thoughts were to simply have a separate points file for the entrered mission data and somehow using an attribute tie this to the drop data that was imported. In other words the user would import the CSV file of drops, press the toolbar button and enter in the mission data which somehow gets tied to all the drops for that mission and all this gets appended to an archive for quering data/reports for our range utilization.

This make any sense? I would appreciate any help.

Bob 



Yes I want to be able to add points to an existing shape file from a VBA form. Yes it is WGS84. Not trying to trigger on an event, I simply added a macro to my toolbar and when I press it the form pops up. From this form I simply want to be able to add a point feature and fill in some attributes. I havent got as far as error checking and am assuming coordinates are correct. Just looking for a very basic start here.
0 Kudos
DuncanHornby
MVP Notable Contributor
Bob

There is one other thing you need to consider, how your user interacts with the data on the screen. So you've got a bunch of points on a map, how would they select them? It would be the selected point that they would want to attach the extra information to. Unless it's some sort of bulk update and information you want applied to ALL bomb sites.

If you need to add information to individual sites then the most sensible way is for the user to say draw a rectangle over the point and that selects it then the form opens up and then can fill in the details.

I think a less efficient way would to select the point by attribute but that would require the user to know some pre-existing ID.

As you mentioned VBA, you are wanting to use UIToolControl for that. But ESRI are phasing out support for VBA so in the long term you'll be shooting yourself in the foot. You could use the new python addin tools or develop it as a VB .net AddIn

Duncan
0 Kudos
bobcollins
New Contributor
Duncan,

       Thanks for your reply. I did not realize they were phasing out the VBA support. I am still using Arcview 9.3.1 but have seen version 10 with the python window. I will look into this when I upgrade.

The user would not have to select the points. The user would enter the additional data after importing the particular mission which would be a newly added event layer of points (layer(0)) and the entered information would attach to this event layer and then be archived.

Do you have a python sample which allows user input and modifies contents of a displayed layer. I do have access to Arcinfo 10 but it is online at our EIMS site and is rather slow.

Bob


Bob

There is one other thing you need to consider, how your user interacts with the data on the screen. So you've got a bunch of points on a map, how would they select them? It would be the selected point that they would want to attach the extra information to. Unless it's some sort of bulk update and information you want applied to ALL bomb sites.

If you need to add information to individual sites then the most sensible way is for the user to say draw a rectangle over the point and that selects it then the form opens up and then can fill in the details.

I think a less efficient way would to select the point by attribute but that would require the user to know some pre-existing ID.

As you mentioned VBA, you are wanting to use UIToolControl for that. But ESRI are phasing out support for VBA so in the long term you'll be shooting yourself in the foot. You could use the new python addin tools or develop it as a VB .net AddIn

Duncan
0 Kudos
DuncanHornby
MVP Notable Contributor
Bob,

When you say you'll be upgraded to 10 do you mean 10.0, 10.1, 10.2 or 10.2.1? I think the python addin tools came in in version 10.1. Have a look at this to see how to develop a tool.

So to get it crystal clear in my mind you have a csv file you import which has for example 10 points with various information, then you want to add mission data, this would be exactly the same for every point? So in effect you are adding a new field lets say its called "mission notes" which is of type string and you populate that with some mission related information? You would need to export the XY event layer to a separate FeatureClass so you could add extra fields.

Well you could create a very simple model that adds a field and inserts the text. If you expose the inputs as parameters then this will look and behave just like any other geoprocessing tool. Creating model tools is discussed here. This would require zero programming.

Duncan
0 Kudos
bobcollins
New Contributor
Duncan,

            Thanks again. 10.1 version is what I have online. I have done the model builder already which imports the CSV into an event layer, copies the rows to a feature class, and appends it to an archive file. You are correct in adding mission data to the points, all the same mission data for the current CSV of points. I would probably need more then a single added field though. i seen how to add a field in model builder but was more interested in a user interface for filling in these added fields.

I will get on 10.1 and check out using the Python wizard for desktop addins.

Bob
Bob,

When you say you'll be upgraded to 10 do you mean 10.0, 10.1, 10.2 or 10.2.1? I think the python addin tools came in in version 10.1. Have a look at this to see how to develop a tool.

So to get it crystal clear in my mind you have a csv file you import which has for example 10 points with various information, then you want to add mission data, this would be exactly the same for every point? So in effect you are adding a new field lets say its called "mission notes" which is of type string and you populate that with some mission related information? You would need to export the XY event layer to a separate FeatureClass so you could add extra fields.

Well you could create a very simple model that adds a field and inserts the text. If you expose the inputs as parameters then this will look and behave just like any other geoprocessing tool. Creating model tools is discussed here. This would require zero programming.

Duncan
0 Kudos