Getting properties from a custom evaluator

3471
8
Jump to solution
03-31-2015 06:19 AM
Highlighted
Occasional Contributor

Hello,

We created a custom evaluator for Network Analyst in ArcGIS 10.3 based upon the Departure Time Transit Evaluator: http://www.arcgis.com/home/item.html?id=72ef24542857413c8981f2e196f1bb13

We can set some properties for this evaluator, but seem not be able to get them out of the evaluator again (to check the configuration).

INetworkEvaluatorSetup.Data always returns Null, even when we set some properties (which are stored). We always see the default settings when checking the properties through ArcGIS Desktop.

So how to check the set properties of a custom evaluator?

Thanks in advance,

Thibaut

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor III

I saw the same problem you did.  I could SET, but after closing the Network Dataset Properties dialog, the properties that were set went back to the default values the next time the dialog was opened (which means that the Data PropertySet was null).

Did you try what I mentioned?

     Open the network dataset properties

     Select the attribute in question and click Evaluators...

     Click on the source for which you want to set the evaluator

     Click on the evalutors properties button

     SET your properties

      Click OK to close the evaluator properties dialog

     ****** Click APPLY on the Attribute properties dialog, then OK ******

     ****** Click APPLY on the Network Dataset properties dialog, then OK ******

    Close the Network Dataset properties dialog

If for some reason, you do not see the APPLY button become enabled, then your properties are not going to persist and the next time you try to get them, that property set will be null.

View solution in original post

8 Replies
Highlighted
Occasional Contributor III

Hello, Thibaut!

Which properties are you trying to access on your evaluator?

I downloaded and tested the Departure Time Evaluator and I was able to set and access the Data PropertySet within PropertiesDialog.cs as the evaluator dialog was being used.

Is that where you are seeing the problem?  While debugging in PropertiesDialog and btnOK_Click?

Also, I'd love to find out what your evaluator is trying to do.  What is your use-case for a custom evaluator?

Thanks,

Patrick

Reply
0 Kudos
Highlighted
Occasional Contributor

Hello Patrick,

For a customer we want to plan shipping routes on inland fairways. To have a good ETA we need to take into account the operating times of the locks and bridges. The time schedules are stored into external xml files. The custom evaluator reads in the time schedule for the lock or bridge and returns a waiting time.

One of the properties for this custom evaluator is the location of the xml files with operating times. We use a properties dialog for the evaluator. When loading the PropertiesDialog we pass along the list of found INetworkEvaluator objects, from which we take the IpropertySet of evaluatorSetup.Data.

If the propertyset is not null we load the settings from there, if not we show the default settings.

But the propertyset is always null, even when the properties were set before.

So we are able to set the properties, but unable to check the values again (when closing and reopening the properties dialog).

Regards,

Thibaut

Reply
0 Kudos
Highlighted
Occasional Contributor III

I was able to reproduce the problem on my end using the DepartureTimeEvaluator! 

Conclusion

     Make sure that you have editing permission on your network.  You should see the APPLY button become enabled on the Network Dataset Properties dialog after you have editing the properties.  If Apply is disabled (note that the "Add.." button will probably be disabled as well), then the properties won't persist.

Gritty Details

     The secret is the "APPLY" button that you see on the Network Dataset Properties dialog.  If you don't ever see that button enabled, then the properties won't get truly applied.

     In my case, I did not have the Network Analyst license turned on.  That made it so I could not truly edit the schema of the dataset.  Once I was able to "Apply" the changes, only then would the properties persist.

     The flaw in the evaluator is that there is no check to make sure that you are able to edit the network schema.  That would be tough, as it would involve license checks, schema lock checks, and whatever other checks that could verify editing is available.

I hope this solves your problem.

Reply
0 Kudos
Highlighted
Occasional Contributor

Thanks for the reaction, but I think there's a misunderstanding. We can SET the properties. The issue is when (after closing the network dataset properties and opening it again) we want to GET the properties we did set.

On ArcObjects level: we can set the data property on INetworkEvaluatorSetup, but when we try to get the data property, it returns always Null. Although when solving routes we notice that we did set our properties. (ArcObjects INetworkEvaluatorSetup )

This means that we can never check if somebody did configure the custom evaluator correctly.

Reply
0 Kudos
Highlighted
Occasional Contributor III

I saw the same problem you did.  I could SET, but after closing the Network Dataset Properties dialog, the properties that were set went back to the default values the next time the dialog was opened (which means that the Data PropertySet was null).

Did you try what I mentioned?

     Open the network dataset properties

     Select the attribute in question and click Evaluators...

     Click on the source for which you want to set the evaluator

     Click on the evalutors properties button

     SET your properties

      Click OK to close the evaluator properties dialog

     ****** Click APPLY on the Attribute properties dialog, then OK ******

     ****** Click APPLY on the Network Dataset properties dialog, then OK ******

    Close the Network Dataset properties dialog

If for some reason, you do not see the APPLY button become enabled, then your properties are not going to persist and the next time you try to get them, that property set will be null.

View solution in original post

Highlighted
Occasional Contributor

Again, thanks for the reply!

I did notice the behaviour you're describing. The Apply button is disabled when for example there's a lock on the network dataset. The more reason to be able to check what settings DO persist in the properties dialog.

But even when the Apply button was enabled and we noticed on the route solving that our settings persist, when you open the network dataset properties for the custom evaluator, we see the default settings. When logging the Data PropertySet, we see this is ALWAYS null. That's why we always see the default settings in the properties dialog and not the actual settings. So setting the properties does work (keeping in mind the Apply button), but getting them to display in the dialog doesn't.

Maybe we're calling the Data PropertySet incorrectly? Is there a specific method for this?

Reply
0 Kudos
Highlighted
Occasional Contributor III

Very interesting!  Is there a chance I could get a copy of your evaluator to try out here?  You could put it on GitHub, or email it to me pstevens at esri.com.

When I try with the Departure Time Evaluator, as long as I have write access to the network dataset, the properties persist fine.

Perhaps you could try the Departure Time Evaluator sample to see if it behaves the same way as your evaluator.  If you do that, be sure to unregister your evaluator, because they might be using the same GUID.

Reply
0 Kudos
Highlighted
Occasional Contributor

I retried one of our first versions of the evaluator and it seems to work fine as long as both the Apply buttons are enabled and used. So we continue with that one.

Many thanks to Patrick Stevens​!

Reply
0 Kudos