Exemple #1
0
        public static GeoEnvelope ReadGeoEnvelopeByRegionKey(string iso3166_2RegionCode)
        {
            iso3166_2RegionCode = ConvertRegionCodeToIso3166_2RegionCode(iso3166_2RegionCode);

            String sql = "SELECT geom FROM level1 WHERE HASC_1 = " + "'" + iso3166_2RegionCode + "'";

            Layer resultLayer = _dataSource.ExecuteSQL(sql, null, "");

            if (resultLayer == null)
            {
                return(null);
            }

            if (resultLayer.GetFeatureCount(0) == 0)
            {
                return(null);
            }

            Envelope envelope = new Envelope();

            int ret = resultLayer.GetExtent(envelope, 1);

            GeoEnvelope geoEnvelope = new GeoEnvelope();

            geoEnvelope.SetData(envelope);

            return(geoEnvelope);
        }
Exemple #2
0
        public static GeoEnvelope ReadGeoEnvelopeByCountryKey(string iso3166_1CountryCode)
        {
            String sql = "SELECT geom FROM level0 WHERE GID_0 = " + "'" + iso3166_1CountryCode + "'";

            Layer resultLayer = _dataSource.ExecuteSQL(sql, null, "");

            if (resultLayer == null)
            {
                return(null);
            }

            if (resultLayer.GetFeatureCount(0) == 0)
            {
                return(null);
            }

            Envelope envelope = new Envelope();

            int ret = resultLayer.GetExtent(envelope, 1);

            GeoEnvelope geoEnvelope = new GeoEnvelope();

            geoEnvelope.SetData(envelope);

            return(geoEnvelope);
        }