Beispiel #1
0
    std::string createURL(const Symbology::Query& query)
    {
        std::stringstream buf;
        buf << _options.url().get() << "?SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature";
        buf << "&TYPENAME=" << _options.typeName().get();
        
        std::string outputFormat = "geojson";
        if (_options.outputFormat().isSet()) outputFormat = _options.outputFormat().get();
        buf << "&OUTPUTFORMAT=" << outputFormat;

        if (_options.maxFeatures().isSet())
        {
            buf << "&MAXFEATURES=" << _options.maxFeatures().get();
        }

        if (query.tileKey().isSet())
        {
            buf << "&Z=" << query.tileKey().get().getLevelOfDetail() << 
                   "&X=" << query.tileKey().get().getTileX() <<
                   "&Y=" << query.tileKey().get().getTileY();
        }
        else if (query.bounds().isSet())
        {
            buf << "&BBOX=" << query.bounds().get().xMin() << "," << query.bounds().get().yMin() << ","
                            << query.bounds().get().xMax() << "," << query.bounds().get().yMax();
        }
        return buf.str();
    }
Beispiel #2
0
    std::string createURL(const Symbology::Query& query)
    {
        std::stringstream buf;
        buf << _options.url()->full() << "?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature";
        buf << "&TYPENAME=" << _typeName;
        
        std::string outputFormat = "geojson";
        if (_options.outputFormat().isSet()) outputFormat = _options.outputFormat().get();
        buf << "&OUTPUTFORMAT=" << outputFormat;

        if (_options.maxFeatures().isSet())
        {
            buf << "&MAXFEATURES=" << _options.maxFeatures().get();
        }

        if (query.tileKey().isSet())
        {
            buf << "&Z=" << query.tileKey().get().getLevelOfDetail() << 
                   "&X=" << query.tileKey().get().getTileX() <<
                   "&Y=" << query.tileKey().get().getTileY();
        }
        else if (query.bounds().isSet())
        {            
            double buffer = *_options.buffer();            
            buf << "&BBOX=" << std::setprecision(16)
                            << query.bounds().get().xMin() - buffer << ","
                            << query.bounds().get().yMin() - buffer << ","
                            << query.bounds().get().xMax() + buffer << ","
                            << query.bounds().get().yMax() + buffer;
        }
        std::string str;
        str = buf.str();
        return str;
    }
 std::string createURL(const Symbology::Query& query)
 {     
     if (query.tileKey().isSet())
     {
         const TileKey &key = query.tileKey().get();
         unsigned int tileX = key.getTileX();
         unsigned int tileY = key.getTileY();
         unsigned int level = key.getLevelOfDetail();
         
         // TFS follows the same protocol as TMS, with the origin in the lower left of the profile.
         // osgEarth TileKeys are upper left origin, so we need to invert the tilekey to request the correct key.
         unsigned int numRows, numCols;
         key.getProfile()->getNumTiles(key.getLevelOfDetail(), numCols, numRows);
         tileY  = numRows - tileY - 1;
         
         std::stringstream buf;
         std::string path = osgDB::getFilePath(_options.url()->full());
         buf << path << "/" << level << "/"
                            << tileX << "/"
                            << tileY
                            << "." << _options.format().get();            
         OE_DEBUG << "TFS url " << buf.str() << std::endl;
         return buf.str();
     }
     return "";                       
 }
 std::string createURL(const Symbology::Query& query)
 {     
     if (query.tileKey().isSet())
     {
         std::stringstream buf;
         std::string path = osgDB::getFilePath(_options.url()->full());
         buf << path << "/" << query.tileKey().get().getLevelOfDetail() << "/"
                            << query.tileKey().get().getTileX() << "/"
                            << query.tileKey().get().getTileY()
                            << "." << _options.format().get();            
         OE_DEBUG << "TFS url " << buf.str() << std::endl;
         return buf.str();
     }
     return "";                       
 }
Beispiel #5
0
    std::string createURL(const Symbology::Query& query)
    {
        std::stringstream buf;
        buf << _options.url()->full() << "?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature";
        buf << "&TYPENAME=" << _options.typeName().get();
        
        std::string outputFormat = "geojson";
        if (_options.outputFormat().isSet()) outputFormat = _options.outputFormat().get();
        buf << "&OUTPUTFORMAT=" << outputFormat;

        if (_options.maxFeatures().isSet())
        {
            buf << "&MAXFEATURES=" << _options.maxFeatures().get();
        }

        if (query.tileKey().isSet())
        {

            unsigned int tileX = query.tileKey().get().getTileX();
            unsigned int tileY = query.tileKey().get().getTileY();
            unsigned int level = query.tileKey().get().getLevelOfDetail();
            
            // Tiled WFS follows the same protocol as TMS, with the origin in the lower left of the profile.
            // osgEarth TileKeys are upper left origin, so we need to invert the tilekey to request the correct key.
            unsigned int numRows, numCols;
            query.tileKey().get().getProfile()->getNumTiles(level, numCols, numRows);
            tileY  = numRows - tileY - 1;

            buf << "&Z=" << level << 
                   "&X=" << tileX <<
                   "&Y=" << tileY;
        }
        else if (query.bounds().isSet())
        {            
            double buffer = *_options.buffer();            
            buf << "&BBOX=" << std::setprecision(16)
                            << query.bounds().get().xMin() - buffer << ","
                            << query.bounds().get().yMin() - buffer << ","
                            << query.bounds().get().xMax() + buffer << ","
                            << query.bounds().get().yMax() + buffer;
        }
        std::string str;
        str = buf.str();
        return str;
    }
    std::string createURL(const Symbology::Query& query)
    {
        std::stringstream buf;
        buf << _options.url()->full() << "?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature";
        buf << "&TYPENAME=" << _options.typeName().get();
        
        std::string outputFormat = "geojson";
        if (_options.outputFormat().isSet()) outputFormat = _options.outputFormat().get();
        buf << "&OUTPUTFORMAT=" << outputFormat;

        if (_options.maxFeatures().isSet())
        {
            buf << "&MAXFEATURES=" << _options.maxFeatures().get();
        }

        if (query.tileKey().isSet())
        {

            unsigned int tileX = query.tileKey().get().getTileX();
            unsigned int tileY = query.tileKey().get().getTileY();
            unsigned int level = query.tileKey().get().getLevelOfDetail();
#if 0
            unsigned int numRows, numCols;
            query.tileKey().get().getProfile()->getNumTiles(level, numCols, numRows);
            tileY  = numRows - tileY - 1;
#endif

            buf << "&Z=" << level << 
                   "&X=" << tileX <<
                   "&Y=" << tileY;
        }
        else if (query.bounds().isSet())
        {            
            double buffer = *_options.buffer();            
            buf << "&BBOX=" << std::setprecision(16)
                            << query.bounds().get().xMin() - buffer << ","
                            << query.bounds().get().yMin() - buffer << ","
                            << query.bounds().get().xMax() + buffer << ","
                            << query.bounds().get().yMax() + buffer;
        }
        std::string str;
        str = buf.str();
        return str;
    }
    std::string createURL(const Symbology::Query& query)
    {     
        if (query.tileKey().isSet())
        {
            const TileKey& key = query.tileKey().get();
            unsigned int tileX = key.getTileX();
            unsigned int tileY = key.getTileY();
            unsigned int level = key.getLevelOfDetail();

            // attempt to verify that the request is within the first and max level
            // of the data source.
            const FeatureProfile* fp = getFeatureProfile();
            if (fp && fp->getTiled())
            {
                if (fp->getFirstLevel() > level || fp->getMaxLevel() < level)
                {
                    return "";
                }
            }

            // TFS follows the same protocol as TMS, with the origin in the lower left of the profile.
            // osgEarth TileKeys are upper left origin, so we need to invert the tilekey to request the correct key.            
            if (_options.invertY() == false)
            {                
                unsigned int numRows, numCols;
                key.getProfile()->getNumTiles(key.getLevelOfDetail(), numCols, numRows);
                tileY  = numRows - tileY - 1;            
            }

            std::stringstream buf;
            std::string path = osgDB::getFilePath(_options.url()->full());
            buf << path << "/" << level << "/"
                               << tileX << "/"
                               << tileY
                               << "." << _options.format().get();            
            return buf.str();
        }
        return "";                       
    }