I have some spatial databases and I am able to connect in visual studio with the SQLClient and read point coordinates and create autocad entities.
I also have access to arcgis/rest/services and would like to create query urls and parse the JSON results to create autocad entities.
Can anyone provide an example, or documentation to get me started? A google search returns several DWG to JSON posts, but I want to go the other way.
I don't want to buy FME Workbench if I don't have to.
TIA
Solved! Go to Solution.
I have some spatial databases and I am able to connect in visual studio with the SQLClient and read point coordinates and create autocad entities.
I also have access to arcgis/rest/services and would like to create query urls and parse the JSON results to create autocad entities.
Can anyone provide an example, or documentation to get me started? A google search returns several DWG to JSON posts, but I want to go the other way.
I don't want to buy FME Workbench if I don't have to.
TIA
Solved! Go to Solution.
Solved by fieldguy. Go to Solution.
Thanks - I have access to FME but that is a last resort.
I am going to cross-post this in the .NET forum.
Thanks - I have access to FME but that is a last resort.
I am going to cross-post this in the .NET forum.
The answer for me was to convert the JSON data to XML. All of the information required for creating DWG data is in the <features> node. <attributes> go to object data, and <geometry> provides the vertices.
I used WebClient to submit the REST services request and download the content, JsonReaderWriterFactory.CreateJsonReader
to read the content, and created an xmldocument from the json reader.
The answer for me was to convert the JSON data to XML. All of the information required for creating DWG data is in the <features> node. <attributes> go to object data, and <geometry> provides the vertices.
I used WebClient to submit the REST services request and download the content, JsonReaderWriterFactory.CreateJsonReader
to read the content, and created an xmldocument from the json reader.
Hi @fieldguy
Could you please explain your answer in a bit more detail? I have to convert json data into autocad entities and I am stuck.
Please could you explain in detail how you went about it?
Hi @fieldguy
Could you please explain your answer in a bit more detail? I have to convert json data into autocad entities and I am stuck.
Please could you explain in detail how you went about it?
Hi @ss6153. I do not have access to any autodesk products anymore. Are you able to access the data through a browser interface? That is what I used to confirm the urls and the results.
Is the data in the public domain (can anyone access it)? Try the code below to see if you get "rootnode".
string url = "the REST data URL"
WebClient wc = new WebClient() // System.Net.WebClient
string content = wc.DownloadString(url)
XmlDocument xdoc = new XmlDocument() // System.Xml.XmlDocument
using (var reader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(content), XmlDictionaryReaderQuotas.Max)) // System.Runtime.Serialization.Json
{
XElement xml = XElement.Load(reader) // System.Xml.Linq;
xdoc.LoadXml(xml.ToString());
XmlNode rootnode = xdoc.FirstChild;
}// using reader
Hi @ss6153. I do not have access to any autodesk products anymore. Are you able to access the data through a browser interface? That is what I used to confirm the urls and the results.
Is the data in the public domain (can anyone access it)? Try the code below to see if you get "rootnode".
string url = "the REST data URL"
WebClient wc = new WebClient() // System.Net.WebClient
string content = wc.DownloadString(url)
XmlDocument xdoc = new XmlDocument() // System.Xml.XmlDocument
using (var reader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(content), XmlDictionaryReaderQuotas.Max)) // System.Runtime.Serialization.Json
{
XElement xml = XElement.Load(reader) // System.Xml.Linq;
xdoc.LoadXml(xml.ToString());
XmlNode rootnode = xdoc.FirstChild;
}// using reader
I just tried. It didn't work as it only supports v7 and v8-DGN
I just tried. It didn't work as it only supports v7 and v8-DGN
Can't find what you're looking for? Ask the community or share your knowledge.