declare namespace gml="http://www.opengis.net/gml";
import module namespace geo = "http://expath.org/ns/geo";
declare option output:method 'json';
let $x :=
element json { attribute type {'object'},
element coords {attribute type {'object'},
element gml:Point {attribute type {'object'},
element gml:coordinates { "0,0" }
}
}
}
let $y := json:serialize($x)
return json:parse($y)
Run…
let $opt := map { "lax": true() }
return json:parse('{ "coords":{
"gml:Point":{
"gml:coordinates":"0,0"
} } }', $opt )/json/coords/*
…and I’m pretty sure you’ll see what is wrong if you compare the
result with the examples in the documentation
(http://docs.basex.org/wiki/Geo_Module#geo:distance ).
On Fri, Nov 24, 2017 at 5:31 PM, E. Wray Johnson <wray.johnson@gmail.com> wrote:
> What is wrong with this code?
>
> import module namespace geo = 'http://expath.org/ns/geo';
> declare namespace gml='http://www.opengis.net/gml ';
>
> let $opt := map { "lax": true() }
> let $y := json:parse('{ "coords":{
> "gml:Point":{
> "gml:coordinates":"0,0"
> } } }', $opt )
>
> let $x := json:parse('{ "coords":{
> "gml:Point":{
> "gml:coordinates":"-123.45,45.343"
> } } }', $opt )
>
> return geo:distance($x/json/coords/*, $y/json/coords/*)