Пример #1
0
void object::test<9>
()
{
    // POINT located on the 3rd vertex of LINESTRING
    // POINT(-23.1094689600055 50.5223376452201)
    std::string point("01010000009c266328061c37c056d8bff5db424940");
    // LINESTRING(-23.122057005539 50.5201976774794,-23.1153476966995 50.5133404815199,-23.1094689600055 50.5223376452201,-23.1094689600055 50.5169177629559,-23.0961967920942 50.5330464848094,-23.0887991006034 50.5258515213185,-23.0852302622362 50.5264582238409)
    std::string
    line("0102000000070000009909bf203f1f37c05c1d66d6954249404afe386d871d37c0a7eb1124b54149409c266328061c37c056d8bff5db42494098266328061c37c0034f7b5c2a42494060065c5aa01837c08ac001de3a4449408401b189bb1637c0b04e471a4f43494014ef84a6d11537c0b20dabfb62434940");
    geom1_ = GEOSGeomFromHEX_buf(reinterpret_cast<const unsigned char*>(line.data()), line.size());
    geom2_ = GEOSGeomFromHEX_buf(reinterpret_cast<const unsigned char*>(point.data()), point.size());
    prepGeom1_ = GEOSPrepare(geom1_);
    ensure(nullptr != prepGeom1_);

    int ret = GEOSPreparedIntersects(prepGeom1_, geom2_);
    ensure_equals(ret, 1);
}
Пример #2
0
    void object::test<5>()
    {
        const char *hex = "0103000020E61000000100000005000000737979F3DDCC2CC0F92154F9E7534540000000000000F07F000000000000F07F8F806E993F7E55C0304B29FFEA8554400634E8D1DD424540B5FEE6A37FCD4540737979F3DDCC2CC0F92154F9E7534540";

        geom1_ = GEOSGeomFromHEX_buf((unsigned char*)hex, std::strlen(hex));
        
        ensure( 0 != geom1_ );

        char const r1 = GEOSIntersects(geom1_, geom1_);

        ensure_equals(int(r1), 2);
        
    }