コード例 #1
0
void GDALWMSMiniDriver_AGS::GetTiledImageInfo(CPLString *url,
                                              const GDALWMSImageRequestInfo &iri,
                                              CPL_UNUSED const GDALWMSTiledImageRequestInfo &tiri,
                                              int nXInBlock,
                                              int nYInBlock)
{
    *url = m_base_url;

    if (m_base_url.ifind( "/identify?") == std::string::npos)
        URLAppend(url, "/identify?");

	URLAppendF(url, "&f=json");

	double fX = GetBBoxCoord(iri, 'x') + nXInBlock * (GetBBoxCoord(iri, 'X') - 
	            GetBBoxCoord(iri, 'x')) / iri.m_sx;
	double fY = GetBBoxCoord(iri, 'y') + (iri.m_sy - nYInBlock) * (GetBBoxCoord(iri, 'Y') - 
	            GetBBoxCoord(iri, 'y')) / iri.m_sy;
	            
    URLAppendF(url, "&geometry=%8f,%8f", fX, fY);
	URLAppendF(url, "&geometryType=esriGeometryPoint");

	URLAppendF(url, "&sr=%s", m_irs.c_str());
	URLAppendF(url, "&layerdefs=");
	URLAppendF(url, "&time=");
	URLAppendF(url, "&layerTimeOptions=");

	CPLString layers("visible");
	if ( m_layers.find("show") != std::string::npos )
	{
		layers = m_layers;
		layers.replace( layers.find("show"), 4, "all" );
	}
	
	if ( m_layers.find("hide") != std::string::npos )
	{
		layers = "top";
	}
	
	if ( m_layers.find("include") != std::string::npos )
	{
		layers = "top";
	}
	
	if ( m_layers.find("exclude") != std::string::npos )
	{
		layers = "top";
	}

	URLAppendF(url, "&layers=%s", layers.c_str());

	URLAppendF(url, "&tolerance=%s", m_identification_tolerance.c_str());
	URLAppendF(url, "&mapExtent=%.8f,%.8f,%.8f,%.8f", 
		GetBBoxCoord(iri, m_bbox_order[0]), GetBBoxCoord(iri, m_bbox_order[1]), 
        GetBBoxCoord(iri, m_bbox_order[2]), GetBBoxCoord(iri, m_bbox_order[3]));
	URLAppendF(url, "&imageDisplay=%d,%d,96", iri.m_sx,iri.m_sy);
	URLAppendF(url, "&returnGeometry=false");

	URLAppendF(url, "&maxAllowableOffset=");
    CPLDebug("AGS", "URL = %s", url->c_str());
}
コード例 #2
0
void GDALWMSMiniDriver_AGS::ImageRequest(CPLString *url, const GDALWMSImageRequestInfo &iri) 
{
    *url = m_base_url;

    if (m_base_url.ifind( "/export?") == std::string::npos)
        URLAppend(url, "/export?");
	
	URLAppendF(url, "&f=image");
	URLAppendF(url, "&bbox=%.8f,%.8f,%.8f,%.8f", 
		GetBBoxCoord(iri, m_bbox_order[0]), GetBBoxCoord(iri, m_bbox_order[1]), 
        GetBBoxCoord(iri, m_bbox_order[2]), GetBBoxCoord(iri, m_bbox_order[3]));
	URLAppendF(url, "&size=%d,%d", iri.m_sx,iri.m_sy);
	URLAppendF(url, "&dpi=");
	URLAppendF(url, "&imageSR=%s", m_irs.c_str());
	URLAppendF(url, "&bboxSR=%s", m_irs.c_str());
	URLAppendF(url, "&format=%s", m_image_format.c_str());

	URLAppendF(url, "&layerdefs=");
	URLAppendF(url, "&layers=%s", m_layers.c_str());

    if(m_transparent.size())
	    URLAppendF(url, "&transparent=%s", m_transparent.c_str());
    else
        URLAppendF(url, "&transparent=%s", "false");
        
	URLAppendF(url, "&time=");
	URLAppendF(url, "&layerTimeOptions=");
	URLAppendF(url, "&dynamicLayers=");

	CPLDebug("AGS", "URL = %s\n", url->c_str());
}
コード例 #3
0
CPLErr WMSMiniDriver_AGS::TiledImageRequest(WMSHTTPRequest &request,
                                            const GDALWMSImageRequestInfo &iri,
                                            CPL_UNUSED const GDALWMSTiledImageRequestInfo &tiri)
{
    CPLString &url = request.URL;
    url = m_base_url;

    // Assume map service if exportImage is not explicitly requested.
    if( (url.ifind("/export?") == std::string::npos) &&
        (url.ifind("/exportImage?") == std::string::npos) )
    {
        url += "/export?";
    }

    URLPrepare(url);
    url += "f=image&dpi=&layerdefs=&layerTimeOptions=&dynamicLayers=";
    char *pszEscapedValue = CPLEscapeString(m_layers, -1, CPLES_URL);
    url += CPLOPrintf("&bbox=%.8f%%2C%.8f%%2C%.8f%%2C%.8f",
                GetBBoxCoord(iri, m_bbox_order[0]), GetBBoxCoord(iri, m_bbox_order[1]),
                GetBBoxCoord(iri, m_bbox_order[2]), GetBBoxCoord(iri, m_bbox_order[3]))
        + CPLOPrintf("&size=%d%%2C%d", iri.m_sx, iri.m_sy)
        + CPLOPrintf("&imageSR=%s", m_irs.c_str())
        + CPLOPrintf("&bboxSR=%s", m_irs.c_str())
        + CPLOPrintf("&format=%s", m_image_format.c_str())
        + CPLOPrintf("&layers=%s", pszEscapedValue);
    CPLFree(pszEscapedValue);

    if( !m_transparent.empty() )
    {
        url +=  "&transparent=" + m_transparent;
    }
    else
    {
        url += "&transparent=false";
    }

    if( !m_time_range.empty() )
    {
        pszEscapedValue = CPLEscapeString(m_time_range, -1, CPLES_URL);
        url += CPLOPrintf("&time=%s", pszEscapedValue);
        CPLFree(pszEscapedValue);
    }
    else
    {
        url += "&time=";
    }

    return CE_None;
}
コード例 #4
0
void WMSMiniDriver_AGS::GetTiledImageInfo(CPLString &url,
                                          const GDALWMSImageRequestInfo &iri,
                                          CPL_UNUSED const GDALWMSTiledImageRequestInfo &tiri,
                                          int nXInBlock,
                                          int nYInBlock)
{
    url = m_base_url;

    if( m_base_url.ifind("/identify?") == std::string::npos )
    {
        url += "/identify?";
    }

    URLPrepare(url);
    // Constant part.
    url += "f=json&geometryType=esriGeometryPoint&returnGeometry=false"
           "&layerdefs=&time=&layerTimeOptions=&maxAllowableOffset=";

    double fX = GetBBoxCoord(iri, 'x') + nXInBlock * (GetBBoxCoord(iri, 'X') -
                GetBBoxCoord(iri, 'x')) / iri.m_sx;
    double fY = GetBBoxCoord(iri, 'y') + (iri.m_sy - nYInBlock) * (GetBBoxCoord(iri, 'Y') -
                GetBBoxCoord(iri, 'y')) / iri.m_sy;

    url += "&geometry=" + std::to_string(fX) + "%2C" + std::to_string(fY) + "&sr=" + m_irs;

    CPLString layers("visible");
    if( m_layers.find("show") != std::string::npos )
    {
        layers = m_layers;
        layers.replace(layers.find("show"), 4, "all");
    }

    if( m_layers.find("hide") != std::string::npos
        || m_layers.find("include") != std::string::npos
        || m_layers.find("exclude") != std::string::npos )
    {
        layers = "top";
    }

    url += "&layers=" + layers;
    url += "&tolerance=" + m_identification_tolerance;
    url += CPLOPrintf("&mapExtent=%.8f%%2C%.8f%%2C%.8f%%2C%.8f",
        GetBBoxCoord(iri, m_bbox_order[0]), GetBBoxCoord(iri, m_bbox_order[1]),
        GetBBoxCoord(iri, m_bbox_order[2]), GetBBoxCoord(iri, m_bbox_order[3]))
        + CPLOPrintf("&imageDisplay=%d%%2C%d%%2C96", iri.m_sx, iri.m_sy);
}
コード例 #5
0
void GDALWMSMiniDriver_WMS::ImageRequest(CPLString *url, const GDALWMSImageRequestInfo &iri) {
    // http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&width=1000&height=500&layers=modis,global_mosaic&styles=&srs=EPSG:4326&format=image/jpeg&bbox=-180.000000,-90.000000,180.000000,090.000000    
    *url = m_base_url;
    URLAppend(url, "&request=GetMap");
    URLAppendF(url, "&version=%s", m_version.c_str());
    URLAppendF(url, "&layers=%s", m_layers.c_str());
    URLAppendF(url, "&styles=%s", m_styles.c_str());
    if (m_srs.size()) URLAppendF(url, "&srs=%s", m_srs.c_str());
    if (m_crs.size()) URLAppendF(url, "&crs=%s", m_crs.c_str());
    if (m_transparent.size()) URLAppendF(url, "&transparent=%s", m_transparent.c_str());
    URLAppendF(url, "&format=%s", m_image_format.c_str());
    URLAppendF(url, "&width=%d", iri.m_sx);
    URLAppendF(url, "&height=%d", iri.m_sy);
    URLAppendF(url, "&bbox=%.8f,%.8f,%.8f,%.8f", 
        GetBBoxCoord(iri, m_bbox_order[0]), GetBBoxCoord(iri, m_bbox_order[1]), 
        GetBBoxCoord(iri, m_bbox_order[2]), GetBBoxCoord(iri, m_bbox_order[3]));
    CPLDebug("WMS", "URL = %s", url->c_str());
}