ThinkGeo.com    |     Documentation    |     Premium Support

Feature.GetGeoJson erroring

Hello,

So I just ran into a very strange issue. This project is a WPF vb/c# application.

Dim returnString As String = feature.GetGeoJson()

This line of code throws a System.Xml.XmlException saying that “Name cannot begin with the ‘3’ character, hexadecimal code 0x33”

Now, my initial thoughts were that something was wrong with my visual studio project or possibly an outdated dll. I spent hours trying to figure out what in the heck was going on. Finally, I look at the ColumnValues dictionary and noticed 2 keys in the dictionary that began with ‘3’. To be exact, “3aCWrkPln” and “3pAcWrkPre”. So I removed the 3 from the beginning of these keys before trying to get their geo json. It worked.

It seems for now there is a work around for me(removing the 3), however, I thought I should make you aware of this snafu.

Let me know if there is anything I can do to fix this on my end since I am still not 100 percent convinced that it is an issue with the GetGeoJson() function.

Thanks!

I did some further testing and it appears to error out with any numbers or special characters (?, , *, etc…). I am going to try to xml encode the keys to see if that works next.

Update: The xml encoding works, however, the encoding changes the string which is not what I was looking for.

Hi Mike,

That’s strange, because I did a quickly test and it looks the special string works well in my machine.

As below is my test code and test result:

string source = "3?\\*abc*";
        string source2 = "3aCWrkPln";

        Feature testFeature = new Feature(0, 0);
        testFeature.ColumnValues.Add("source", source);
        testFeature.ColumnValues.Add("source2", source2);

{“geometry”:{“coordinates”:[0,0],“type”:“Point”},“properties”:{“source”:“3?\abc”,“source2”:“3aCWrkPln”},“bbox”:[-5E-06,-5E-06,5E-06,5E-06],“id”:“71a6ae66-a222-4342-918b-4a7a0bdd886f”,“type”:“Feature”}

It works well without exception.

So I think you should want to download our latest version and try that again.

Regards,

Don

Hi Don,

The dll’s we were using were slightly out of date. We have updated to the most current stable dll’s and tested. Unfortunately, the problem still exists. As of now, we have a work around for this issue we are experiencing. I just find it very odd it is happening. Makes me think it could be something with our project setup and not the actual function.

Thanks!

Hi Mike,

Thanks for your update.

Any question please let us know.

Regards,

Don