On Monday, December 26, 2016 at 12:22:46 PM UTC-8, Ivan Mainetti wrote:
>
> Hi,
> I hope I understood your need, I did the following test:
>
> *test data:*
> insert into POI set prop1="Sorint", geometry={"@class":"Geometry","type":
> "Point", "coordinates":[45.6474562,9.7055546]}
> insert into POI set prop1="TNT", geometry={"@class":"Geometry","type":
> "Point", "coordinates":[45.6483712,9.7072927]}
>
> +----+-----+------+------+------------------------------------+
> |# |@RID |@CLASS|prop1 |geometry |
> +----+-----+------+------+------------------------------------+
> |0 |#23:0|POI |Sorint|Geometry{coordinates:[2],type:Point}|
> |1 |#24:0|POI |TNT |Geometry{coordinates:[2],type:Point}|
> +----+-----+------+------+------------------------------------+
>
>
> *test query to find distance b/w 2 POIs above:*
> select ST_Distance_Sphere(ST_GEOMFROMTEXT("POINT(".append($a.geom1[0]).
> append(" ").append($a.geom2[0]).append(")")),ST_GEOMFROMTEXT("POINT(".
> append($b.geom1[0]).append(" ").append($b.geom2[0]).append(")"))) as
> distance
>
>
> let $a=(
> select coordinates[0] as geom1, coordinates[1] as geom2 from (
> select expand(geometry) from POI
> where prop1 = "Sorint"
> )
> ),
> $b=(
> select coordinates[0] as geom1, coordinates[1] as geom2 from (
> select expand(geometry) from POI
> where prop1 = "TNT"
> )
> )
>
>
> +----+------------------+
> |# |distance |
> +----+------------------+
> |0 |217.98214528042894|
> +----+------------------+
>
>
>
>
>
> Il giorno lunedì 26 dicembre 2016 19:41:39 UTC+1, Gregory Mace ha scritto:
>>
>> I've imported a large number of Objects that have location information in
>> the form of:
>>
>> POI
>> bunch of other fields ...
>>
>> * geometry:*
>> * type: 'Point',*
>> * coordinates: [ double, double ] // lon, lat*
>> * dimension: (int size of coordinates )*
>>
>>
>> I thought I would be able to look at the *geometry* field as an *OPoint*
>> and run spatial queries on this but I get an exception:
>>
>> *com.orientechnologies.orient.core.exception.OValidationException:
>> impossible to convert value of field "geometry", incompatible with OPoint*
>>
>> Is there something I can do to realize this field (geometry) as an
>> OPoint? I do not really want to have an OPoint embedded in my domain class
>> (in addition to what I have already), also am not quite sure if I can do
>> that. I already have the geo info in my domain class so would rather not go
>> through the extra effort of adding an additional field to the Vertex in
>> order to do my spatial query. Is there possibly a different way I can
>> accomplish this?
>>
>>
>>
>>
>>
>>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" 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.