ThinkGeo.com    |     Documentation    |     Premium Support

Clarification on adding features info via blogpost

In the following link

it says if using InternalFeatures to add, the feature should be in the external projection when adding. This doesn’t seem to be correct, but I just want to clarify. Should the features be in the internal projection instead?

Also, in my app there are some derived types from Feature, but when using the Add/Update transaction, or using a projection converter, the functions always return Feature, not the original type, and thus I’m losing some extra properties. This is why I’d like the clarification.

Also, if using InternalFeatures, is there anything else that needs to be done besides calling BuildIndex() after?

Thanks,
Dan

Hi Dan,

Good Catch! You are right it should be using the internal projection for InMemoryFeatureLayer.InternalFeatures. We’ve updated that blog, please refresh and check it out. Thanks for letting us know!

Here below is a quick example how you can do the reprojection for a CustomFeature. You can just update the WKB to accomplish the reprojection while keeping the other attributes. Both of the SetWellKnownBinary() and GetWellKnownBinary are fast.

        CustomFeature a = new CustomFeature();
        var b = ProjectionConverter.Convert(4326, 3857, a);
        a.SetWellKnownBinary(b.GetWellKnownBinary());

You don’t need to do anything other than BuildIndex() after updating InternalFeatures. You don’t actually need to call BuildIndex() if there’re less than 100 features as it will be fast anyway.

Thanks,
Ben

1 Like

Thanks Ben! Didn’t know about the setwellknownbinary, good to know.

Sure! Again, thanks for letting us know the issue in the blog!