Aha, that is more concise than what I ended up with. I didn't think to look
for built-in Django functions. Thanks!

Adam

On Mon, Jun 6, 2016 at 2:46 PM, Rob Gaston <[email protected]> wrote:

> Hi Adam,
>
> Arches includes all the tools you need to do this conversion on either the
> client or server.
>
> I've created a gist here
> <https://gist.github.com/robgaston/cc206d0e8ec6da831a24c48746aa0c08> with
> a python file showing how to do it on the server and a javascript file
> showing how to do it on client.
>
> Let me know if you have questions about it.
>
> Hope that helps!
> - Rob
>
> On Wednesday, June 1, 2016 at 9:43:29 AM UTC-7, Adam Cox wrote:
>>
>> I'm recording different types of geometry for a given resource (Project
>> Area vs. Area of Potential Effect, in this case), and would like a little
>> feedback on the following methodology, if anyone has any.
>>
>> For background, a simple v3 resource with one polygon looks like this in
>> its raw json form:
>>
>> {
>>   "_index": "resource",
>>   "_version": 5,
>>   "typename": "Management Activity (A)",
>>   "source": {
>>     "geometry": {
>>       "type": "GeometryCollection",
>>       "geometries": [
>>         {
>>           "type": "Polygon",
>>           "coordinates": [
>>             [
>>               [
>>                 -77.01996456234521,
>>                 38.93674344318805
>>               ],
>>               [
>>                 -77.01708923428123,
>>                 38.93480730232329
>>               ],
>>               [
>>                 -77.01309810726707,
>>                 38.9378116362102
>>               ],
>>               [
>>                 -77.0173896416909,
>>                 38.93897995390404
>>               ],
>>               [
>>                 -77.01932504997106,
>>                 38.93729891398618
>>               ],
>>               [
>>                 -77.01996456234521,
>>                 38.93674344318805
>>               ]
>>             ]
>>           ]
>>         },
>>       ]
>>     },
>>     "graph": {
>>       "PLACE_E53": [
>>         {
>>           "SPATIAL_COORDINATES_GEOMETRY_E47": [
>>             {
>>               "ACTIVITY_GEOMETRY_TYPE_E55__label": "Project Area",
>>               "ACTIVITY_GEOMETRY_TYPE_E55__value": "Project Area",
>>               "SPATIAL_COORDINATES_GEOMETRY_E47__value": "POLYGON
>> ((-77.0199645623452080 38.9367434431880500, -77.0170892342812290
>> 38.9348073023232930, -77.0130981072670690 38.9378116362101990,
>> -77.0173896416908970 38.9389799539040380, -77.0193250499710590
>> 38.9372989139861830, -77.0199645623452080 38.9367434431880500))",
>>               "SPATIAL_COORDINATES_GEOMETRY_E47__label": "POLYGON
>> ((-77.0199645623452080 38.9367434431880500, -77.0170892342812290
>> 38.9348073023232930, -77.0130981072670690 38.9378116362101990,
>> -77.0173896416908970 38.9389799539040380, -77.0193250499710590
>> 38.9372989139861830, -77.0199645623452080 38.9367434431880500))"
>>             }
>>           ]
>>         },
>>       ]
>>     },
>>     "value": "",
>>     "label": "",
>>     "primaryname": "Unnamed Resource",
>>     "child_entities": [],
>>     "entitytypeid": "ACTIVITY_A.E7",
>>     "entityid": "37b91e97-bb78-4dee-864b-c493052151c9",
>>     "property": "",
>>     "businesstablename": ""
>>   },
>>   "found": true,
>>   "_id": "37b91e97-bb78-4dee-864b-c493052151c9",
>>   "type": "ACTIVITY_A.E7"
>> }
>>
>> As you can see, a single geometry is stored in two separate places, once
>> in this list, resource["source"]["geometry"] (which is stored in
>> GeoJSON) and once within the full graph structure,
>> resource["graph"]["PLACE_E53"]["SPATIAL_COORDINATES_E47"][
>> "SPATIAL_COORDINATES_GEOMETRY_E47__value"] (which is stored in WKT).  In
>> all mapped representations of the resource, the GeoJSON is used.  However,
>> the geometry type that is stored in the graph, in this case, "Project Area"
>> (but in Arches-HIP this could be "vicinity point",or "perimeter polygon")
>> is completely lost in the GeoJSON representation.
>>
>> I'd like to show Project Areas and Areas of Potential Effect in different
>> colors.  To do so, I'll sort through the resource graph and create new
>> geometry collections.  Thing is, I'll need to convert these geometries from
>> the graph WKT to GeoJSON. I've found a couple of methods for this
>> https://gist.github.com/drmalex07/5a54fc4f1db06a66679e and
>> https://github.com/larsbutler/geomet.
>>
>> I'm wondering if anyone has any thoughts on this, or whether this
>> conversion is handled in a different manner elsewhere in the Arches app?
>> If not, were there ever plans in Arches-HIP to display the difference
>> between (for example) a vicinity point and an access point?
>>
>> Adam
>>
>>
>>
>> --
> -- To post, send email to [email protected]. To unsubscribe,
> send email to [email protected]. For more
> information, visit https://groups.google.com/d/forum/archesproject?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Arches Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- To post, send email to [email protected]. To unsubscribe, send 
email to [email protected]. For more information, 
visit https://groups.google.com/d/forum/archesproject?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to