I am working with Esri flex 2.3 API, I am also using Abode BlazeDS for server side binding. I am sending a geometry as WKT from server into my flex client and I am looking for a way to convert the string into a flex geometry so that i can make a Graphic object and add to Feature Layer! or do I have to write a parser myself to accomplish this?

3 Answers 3


On the server side, why not just format to ESRI's JSON format - which is very similar to GeoJSON? So, the workflow would look something like:

1.  Convert geometry to GeoJSON
2.  Convert GeoJSON to ESRI JSON

3.  Create feature set by FeatureSet.fromJSON()

Neither ActionScript3 nor the Flex framework offer "raw" geometry objects beyond the basic Point() class. In other words, there are no Line() or Polygon() classes, much less MultiLine() or MultiPolygon() classes. I'm personally not aware of a 3rd-party library that will take you from WKT right into ESRI-proprietary geometry objects.

With that said, I believe the bottom line is this: You will still have to adapt your inputs --be they WKT from your database, or conversions out of a 3rd-party libary --into the required ESRI proprietary geometry objects before you can expect to push them into an ESRI Feature Layer object.

On the bright side, it's not difficult to get your head around the Well Known Text geometry formats. As such, I encourage you to perceive the task of writing a class to perform your WKT to ESRI geom conversions as a "fun escape" from your normal day-to-day tasks. :)

Here's a thought: Could you start such a project and release it on code.google as a 3rd-party lib so other ActionScripters could quickly and painlessly add such support to their ESRI Flex viewers?? Be warned that I have given the legality of this zero-consideration. :p

[Edit] If you are looking for some related open source code to retool, I would recommend perusing the OpenScales codebase for useful bits. OpenScales has some WKT support, plus it's already in AS3/Flex; so you could expect to reuse some of their code as a convenient springboard.


Afaik, ESRI does not provide a WKT conversion method, so you would have to write your own or try to find a 3rd party ActionScript library to do it (though it would still require modifications). SharpMap has a WKT parser that you could use to speed up the process of rolling your own parser: GeometryFromWKT.cs

As a side note, ArcObjects exposes methods to convert ArcObject geometries to WKB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.