mirror of
https://github.com/Skyai-io/landsat-util.git
synced 2026-03-10 09:01:18 +00:00
Total directory restructure
This commit is contained in:
@@ -1,300 +0,0 @@
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
|
||||
|
||||
<head profile="http://gmpg.org/xfn/11">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<title>Admin 0 – Countries | Natural Earth</title>
|
||||
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
|
||||
<link rel="alternate" type="application/rss+xml" title="Natural Earth RSS Feed" href="http://www.naturalearthdata.com/feed/" />
|
||||
<link rel="pingback" href="http://www.naturalearthdata.com/xmlrpc.php" />
|
||||
<script type="text/javascript" src="http://www.naturalearthdata.com/wp-content/themes/NEV/includes/js/suckerfish.js"></script>
|
||||
<!--[if lt IE 7]>
|
||||
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>
|
||||
<script defer="defer" type="text/javascript" src="http://www.naturalearthdata.com/wp-content/themes/NEV/includes/js/pngfix.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="http://www.naturalearthdata.com/wp-content/themes/NEV/style.css" type="text/css" media="screen" />
|
||||
|
||||
<meta name='Admin Management Xtended WordPress plugin' content='2.1.1' />
|
||||
<link rel="alternate" type="application/rss+xml" title="Natural Earth » Admin 0 – Countries Comments Feed" href="http://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/feed/" />
|
||||
<link rel='stylesheet' id='sociable-front-css-css' href='http://www.naturalearthdata.com/wp-content/plugins/sociable/sociable.css?ver=2.9.2' type='text/css' media='' />
|
||||
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.naturalearthdata.com/xmlrpc.php?rsd" />
|
||||
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.naturalearthdata.com/wp-includes/wlwmanifest.xml" />
|
||||
<link rel='index' title='Natural Earth' href='http://www.naturalearthdata.com' />
|
||||
<link rel='start' title='Welcome to the Natural Earth Blog' href='http://www.naturalearthdata.com/blog/miscellaneous/test/' />
|
||||
<link rel='prev' title='Admin 0 – Details' href='http://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-details/' />
|
||||
<link rel='next' title='Lakes + Reservoirs' href='http://www.naturalearthdata.com/downloads/110m-physical-vectors/110mlakes-reservoirs/' />
|
||||
<meta name="generator" content="WordPress 2.9.2" />
|
||||
|
||||
<!-- All in One SEO Pack 1.6.10.2 by Michael Torbert of Semper Fi Web Design[309,457] -->
|
||||
<meta name="description" content="There are 247 countries in the world. Greenland as separate from Denmark. Most users will want this file instead of sovereign" />
|
||||
<link rel="canonical" href="http://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/" />
|
||||
<!-- /all in one seo pack -->
|
||||
|
||||
<!-- begin gallery scripts -->
|
||||
<link rel="stylesheet" href="http://www.naturalearthdata.com/wp-content/plugins/featured-content-gallery/css/jd.gallery.css.php" type="text/css" media="screen" charset="utf-8"/>
|
||||
<link rel="stylesheet" href="http://www.naturalearthdata.com/wp-content/plugins/featured-content-gallery/css/jd.gallery.css" type="text/css" media="screen" charset="utf-8"/>
|
||||
<script type="text/javascript" src="http://www.naturalearthdata.com/wp-content/plugins/featured-content-gallery/scripts/mootools.v1.11.js"></script>
|
||||
<script type="text/javascript" src="http://www.naturalearthdata.com/wp-content/plugins/featured-content-gallery/scripts/jd.gallery.js.php"></script>
|
||||
<script type="text/javascript" src="http://www.naturalearthdata.com/wp-content/plugins/featured-content-gallery/scripts/jd.gallery.transitions.js"></script>
|
||||
<!-- end gallery scripts -->
|
||||
<style type="text/css">.broken_link, a.broken_link {
|
||||
text-decoration: line-through;
|
||||
}</style><link href="http://www.naturalearthdata.com/wp-content/themes/NEV/css/default.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
|
||||
<!--[if lte IE 7]>
|
||||
<link rel="stylesheet" type="text/css" href="http://www.naturalearthdata.com/wp-content/themes/NEV/ie.css" />
|
||||
<![endif]-->
|
||||
<script src="http://www.naturalearthdata.com/wp-content/themes/NEV/js/jquery-1.2.6.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
jQuery.noConflict();
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
var tabContainers = $('div#maintabdiv > div');
|
||||
tabContainers.hide().filter('#comments').show();
|
||||
|
||||
$('div#maintabdiv ul#tabnav a').click(function () {
|
||||
tabContainers.hide();
|
||||
tabContainers.filter(this.hash).show();
|
||||
$('div#maintabdiv ul#tabnav a').removeClass('current');
|
||||
$(this).addClass('current');
|
||||
return false;
|
||||
}).filter('#comments').click();
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" language="javascript" src="http://www.naturalearthdata.com/dataTables/media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#ne_table').dataTable();
|
||||
} );
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
<div id="headerimg">
|
||||
<h1><a href="http://www.naturalearthdata.com/"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/nev_logo.png" alt="Natural Earth title="Natural Earth" /></a></h1>
|
||||
<div class="description">Free vector and raster map data at 1:10m, 1:50m, and 1:110m scales</div>
|
||||
<div class="header_search"><form method="get" id="searchform" action="http://www.naturalearthdata.com/">
|
||||
<label class="hidden" for="s">Search for:</label>
|
||||
<div><input type="text" value="" name="s" id="s" />
|
||||
<input type="submit" id="searchsubmit" value="Search" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!--<div class="translate_panel" style="align:top; margin-left:650px; top:50px;">
|
||||
<div id="google_translate_element" style="float:left;"></div>
|
||||
<script>
|
||||
function googleTranslateElementInit() {
|
||||
new google.translate.TranslateElement({
|
||||
pageLanguage: 'en'
|
||||
}, 'google_translate_element');
|
||||
}
|
||||
</script>
|
||||
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
|
||||
</div>-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="pagemenu" style="align:bottom;">
|
||||
<ul id="page-list" class="clearfix"><li class="page_item page-item-4"><a href="http://www.naturalearthdata.com" title="Home">Home</a></li>
|
||||
<li class="page_item page-item-10"><a href="http://www.naturalearthdata.com/features/" title="Features">Features</a></li>
|
||||
<li class="page_item page-item-12"><a href="http://www.naturalearthdata.com/downloads/" title="Downloads">Downloads</a></li>
|
||||
<li class="page_item page-item-6 current_page_parent"><a href="http://www.naturalearthdata.com/blog/" title="Blog">Blog</a></li>
|
||||
<li class="page_item page-item-14"><a href="http://www.naturalearthdata.com/forums" title="Forums">Forums</a></li>
|
||||
<li class="page_item page-item-366"><a href="http://www.naturalearthdata.com/corrections" title="Corrections">Corrections</a></li>
|
||||
<li class="page_item page-item-16"><a href="http://www.naturalearthdata.com/about/" title="About">About</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<hr /> <div id="main">
|
||||
<div id="content" class="narrowcolumn">
|
||||
|
||||
|
||||
« <a href="http://www.naturalearthdata.com/downloads/50m-cultural-vectors/">1:50m Cultural Vectors</a>
|
||||
<div class="post" id="post-1541">
|
||||
<h2>Admin 0 – Countries</h2>
|
||||
<div class="entry">
|
||||
<div class="downloadPromoBlock">
|
||||
<div style="float: left; width: 170px;"><img class="alignleft size-thumbnail wp-image-92" title="home_image_3" src="http://www.naturalearthdata.com/wp-content/uploads/2009/09/countries_thumnail.png" alt="countries_thumb" width="150" height="97" /></div>
|
||||
<div style="float: left; width: 410px;"><em>There are 247 countries in the world. Greenland as separate from Denmark. Most users will want this file instead of sovereign states.</em></p>
|
||||
<div class="download-link-div">
|
||||
<a class="download-link" rel="nofollow" title="Downloaded 7306 times (Shapefile, geoDB, or TIFF format)" onclick="if (window.urchinTracker) urchinTracker ('http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries.zip');" href="http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries.zip" onclick="javascript:pageTracker._trackPageview('/downloads/http///download/50m/cultural/ne_50m_admin_0_countries.zip');">Download countries</a> <span class="download-link-span">(798.39 KB) version 2.0.0</span>
|
||||
</div>
|
||||
<div class="download-link-div">
|
||||
<a class="download-link" rel="nofollow" title="Downloaded 3 times (Shapefile, geoDB, or TIFF format)" onclick="if (window.urchinTracker) urchinTracker ('http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries_lakes.zip');" href="http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries_lakes.zip" onclick="javascript:pageTracker._trackPageview('/downloads/http///download/50m/cultural/ne_50m_admin_0_countries_lakes.zip');">Download without boundary lakes</a> <span class="download-link-span">(854.08 KB) version 2.0.0</span>
|
||||
</div>
|
||||
<p><span id="more-1541"></span></div>
|
||||
</div>
|
||||
<div class="downloadMainBlock">
|
||||
<p><img class="alignnone size-full wp-image-1896" title="countries_banner" src="http://www.naturalearthdata.com/wp-content/uploads/2009/09/countries_banner1.png" alt="countries_banner" width="580" height="150" /></p>
|
||||
<p><strong>About</strong></p>
|
||||
<p>Countries distinguish between metropolitan (homeland) and independent and semi-independent portions of sovereign states. If you want to see the dependent overseas regions broken out (like in ISO codes, see France for example), use <a href="http://www.naturalearthdata.com/downloads/10m-political-vectors/10m-admin-0-nitty-gritty/" >map units</a> instead.</p>
|
||||
<p>Each country is coded with a world region that roughly follows the <a href="http://unstats.un.org/unsd/methods/m49/m49regin.htm" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://unstats.un.org/unsd/methods/m49/m49regin.htm');">United Nations setup</a>.</p>
|
||||
<p>Includes some thematic data from the United Nations, U.S. Central Intelligence Agency, and elsewhere.</p>
|
||||
<p><strong>Disclaimer</strong></p>
|
||||
<p>Natural Earth Vector draws boundaries of countries according to defacto status. We show who actually controls the situation on the ground. Please feel free to mashup our disputed areas (link) theme to match your particular political outlook.</p>
|
||||
<p><strong>Known Problems</strong></p>
|
||||
<p>None.</p>
|
||||
<p><strong>Version History</strong></p>
|
||||
<ul>
|
||||
<li>
|
||||
<a rel="nofollow" title="Download version 2.0.0 of ne_50m_admin_0_countries.zip" href="http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries.zip" onclick="javascript:pageTracker._trackPageview('/downloads/http///download/50m/cultural/ne_50m_admin_0_countries.zip');">2.0.0</a>
|
||||
</li>
|
||||
<li>
|
||||
1.4.0
|
||||
</li>
|
||||
<li>
|
||||
1.3.0
|
||||
</li>
|
||||
<li>
|
||||
1.1.0
|
||||
</li>
|
||||
<li>
|
||||
1.0.0
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p><a href="https://github.com/nvkelso/natural-earth-vector/blob/master/CHANGELOG" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://github.com/nvkelso/natural-earth-vector/blob/master/CHANGELOG');">The master changelog is available on Github »</a>
|
||||
</div>
|
||||
|
||||
<div class="sociable">
|
||||
<div class="sociable_tagline">
|
||||
<strong>Share and Enjoy:</strong>
|
||||
</div>
|
||||
<ul>
|
||||
<li class="sociablefirst"><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=Admin%200%20-%20Countries%20-%20http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://twitter.com/home?status=Admin%200%20-%20Countries%20-%20http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F');" title="Twitter"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="Twitter" alt="Twitter" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-343px -55px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&t=Admin%200%20-%20Countries" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&t=Admin%200%20-%20Countries');" title="Facebook"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="Facebook" alt="Facebook" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-343px -1px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&bodytext=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://digg.com/submit?phase=2&url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&bodytext=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di');" title="Digg"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="Digg" alt="Digg" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-235px -1px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&notes=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://delicious.com/post?url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&notes=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di');" title="del.icio.us"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="del.icio.us" alt="del.icio.us" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-199px -1px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&bkmk=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&annotation=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.google.com/bookmarks/mark?op=edit&bkmk=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&annotation=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di');" title="Google Bookmarks"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="Google Bookmarks" alt="Google Bookmarks" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-91px -19px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=Admin%200%20-%20Countries&url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://slashdot.org/bookmark.pl?title=Admin%200%20-%20Countries&url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F');" title="Slashdot"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="Slashdot" alt="Slashdot" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-145px -55px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries');" title="StumbleUpon"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="StumbleUpon" alt="StumbleUpon" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-217px -55px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="mailto:?subject=Admin%200%20-%20Countries&body=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F" title="email"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="email" alt="email" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-325px -1px" class="sociable-hovers" /></a></li>
|
||||
<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&source=Natural+Earth+Free+vector+and+raster+map+data+at+1%3A10m%2C+1%3A50m%2C+and+1%3A110m+scales&summary=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries&source=Natural+Earth+Free+vector+and+raster+map+data+at+1%3A10m%2C+1%3A50m%2C+and+1%3A110m+scales&summary=%0D%0A%0D%0AThere%20are%20247%20countries%20in%20the%20world.%20Greenland%20as%20separate%20from%20Denmark.%20Most%20users%20will%20want%20this%20file%20instead%20of%20sovereign%20states.%0D%0A%0D%0A%5Bdrain%20file%20114%20show%20nev_download%5D%0D%0A%0D%0A%5Bdrain%20file%20350%20show%20nev_download%5D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAbout%0D%0A%0D%0ACountries%20di');" title="LinkedIn"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="LinkedIn" alt="LinkedIn" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-1px -37px" class="sociable-hovers" /></a></li>
|
||||
<li class="sociablelast"><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://reddit.com/submit?url=http%3A%2F%2Fwww.naturalearthdata.com%2Fdownloads%2F50m-cultural-vectors%2F50m-admin-0-countries-2%2F&title=Admin%200%20-%20Countries');" title="Reddit"><img src="http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.gif" title="Reddit" alt="Reddit" style="width: 16px; height: 16px; background: transparent url(http://www.naturalearthdata.com/wp-content/plugins/sociable/images/services-sprite.png) no-repeat; background-position:-55px -55px" class="sociable-hovers" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="sidebar">
|
||||
<ul><li id='text-5' class='widget widget_text'><h2 class="widgettitle">Stay up to Date</h2>
|
||||
<div class="textwidget"> Know when a new version of Natural Earth is released by subscribing to our <a href="http://www.naturalearthdata.com/updates/" class="up-to-date-link" >announcement list</a>.</div>
|
||||
</li></ul><ul><li id='text-2' class='widget widget_text'><h2 class="widgettitle">Find a Problem?</h2>
|
||||
<div class="textwidget"><div>
|
||||
<div style="float:left; width:65px;"><a href="/corrections/index.php?a=add"><img class="alignleft" title="New Ticket" src="http://www.naturalearthdata.com/corrections/img/newticket.png" alt="" width="60" height="60" /></a></div><div class="textwidget" style="float:left;width:120px; font-size:1.2em; font-size-adjust:none; font-style:normal;
|
||||
font-variant:normal; font-weight:normal; line-height:normal;">Submit suggestions and bug reports via our <a href="/corrections/index.php?a=add">correction system</a> and track the progress of your edits.</div>
|
||||
</div></div>
|
||||
</li></ul><ul><li id='text-3' class='widget widget_text'><h2 class="widgettitle">Join Our Community</h2>
|
||||
<div class="textwidget"><div>
|
||||
<div style="float:left; width:65px;"><a href="/forums/"><img src="http://www.naturalearthdata.com/wp-content/uploads/2009/08/green_globe_chat_bubble_562e.png" alt="forums" title="Chat in the forum!" width="50" height="50" /></a></div><div class="textwidget" style="float:left;width:120px; font-size:1.2em; font-size-adjust:none; font-style:normal;
|
||||
font-variant:normal; font-weight:normal; line-height:normal;">Talk back and discuss Natural Earth in the <a href="/forums/">Forums</a>.</div>
|
||||
</div></div>
|
||||
</li></ul><ul><li id='text-4' class='widget widget_text'><h2 class="widgettitle">Thank You</h2>
|
||||
<div class="textwidget">Our data downloads are generously hosted by Florida State University.</div>
|
||||
</li></ul> </div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<div id="footer">
|
||||
<div id="footerarea">
|
||||
<div id="footerlogos">
|
||||
<p>Supported by:</p>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.nacis.org" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/nacis.png" alt="NACIS" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.cartotalk.com" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/cartotalk_ad.png" alt="Cartotalk" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.mapgiving.org" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/mapgiving.png" alt="Mapgiving" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.geography.wisc.edu/cartography/" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/wisconsin.png" alt="University of Wisconsin Madison - Cartography Dept." /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.shadedrelief.com" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/shaded_relief.png" alt="Shaded Relief" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.xnrproductions.com " target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/xnr.png" alt="XNR Productions" /></a>
|
||||
</div>
|
||||
|
||||
<p style="clear:both;"></p>
|
||||
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.freac.fsu.edu" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/fsu.png" alt="Florida State University - FREAC" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.springercartographics.com" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/scllc.png" alt="Springer Cartographics LLC" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.washingtonpost.com" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/wpost.png" alt="Washington Post" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.redgeographics.com" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/redgeo.png" alt="Red Geographics" /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://kelsocartography.com/blog " target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/kelso.png" alt="Kelso Cartography" /></a>
|
||||
</div>
|
||||
|
||||
<p style="clear:both;"></p>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.avenza.com" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/avenza.png" alt="Avenza Systems Inc." /></a>
|
||||
</div>
|
||||
<div class="footer-ad-box">
|
||||
<a href="http://www.stamen.com" target="_blank"><img src="http://www.naturalearthdata.com/wp-content/themes/NEV/images/stamen_ne_logo.png" alt="Stamen Design" /></a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<p style="clear:both;"></p>
|
||||
<span id="footerleft">
|
||||
© 2012. Natural Earth. All rights reserved.
|
||||
</span>
|
||||
<span id="footerright">
|
||||
<!-- Please help promote WordPress and simpleX. Do not remove -->
|
||||
<div>Powered by <a href="http://wordpress.org/">WordPress</a></div>
|
||||
<div><a href="http://www.naturalearthdata.com/wp-admin">Staff Login »</a></div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google Analytics for WordPress | http://yoast.com/wordpress/google-analytics/ -->
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var pageTracker = _gat._getTracker("UA-10168306-1");
|
||||
} catch(err) {}
|
||||
</script>
|
||||
<script src="http://www.naturalearthdata.com/wp-content/plugins/google-analytics-for-wordpress/custom_se.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
// Cookied already:
|
||||
pageTracker._trackPageview();
|
||||
} catch(err) {}
|
||||
</script>
|
||||
<!-- End of Google Analytics code -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
2.0.0
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
150
landsat_util.py
150
landsat_util.py
@@ -1,150 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# USGS Landsat Imagery Util
|
||||
#
|
||||
#
|
||||
# Author: developmentseed
|
||||
# Contributer: scisco
|
||||
#
|
||||
# License: CC0 1.0 Universal
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import datetime
|
||||
from optparse import OptionParser
|
||||
|
||||
import landsat_util.settings
|
||||
from landsat_util.gs_helper import GsHelper
|
||||
from landsat_util.clipper_helper import Clipper
|
||||
from landsat_util.metadata_helper import Metadata
|
||||
|
||||
# FNULL = open(os.devnull, 'w') #recreating /dev/null
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Main function - launches the program
|
||||
"""
|
||||
# Define options
|
||||
parser = OptionParser()
|
||||
parser.add_option("--search_array",
|
||||
help="Include a search array in this format: \
|
||||
\"path,row,path,row, ... \"",
|
||||
metavar="\"path,row,path,row, ... \"")
|
||||
parser.add_option("--start",
|
||||
help="Start Date - Format: MM/DD/YYYY",
|
||||
metavar="01/27/2014")
|
||||
parser.add_option("--end",
|
||||
help="End Date - Format: MM/DD/YYYY",
|
||||
metavar="02/27/2014")
|
||||
parser.add_option("--shapefile",
|
||||
help="Generate rows and paths from a shapefile. You must\
|
||||
create a folder called 'shapefile_input'. You must add \
|
||||
your shapefile to this folder.",
|
||||
metavar="my_shapefile.shp")
|
||||
parser.add_option("--country",
|
||||
help="Enter country NAME or CODE that will designate \
|
||||
imagery area, for a list of country syntax visit \
|
||||
(\"https://docs.google.com/spreadsheets/d/1CgC0rrvvT8uF9dgeNMI0CVVqc0z85N-K9cEVnN01aN8/edit?usp=sharing)\"",
|
||||
metavar="Italy")
|
||||
parser.add_option("--update-metadata",
|
||||
help="Update ElasticSearch Metadata. Requires access \
|
||||
to an Elastic Search instance",
|
||||
action='store_true',
|
||||
dest='umeta')
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Raise an error if no option is given
|
||||
raise_error = True
|
||||
|
||||
# Execute search_array sequence
|
||||
if options.search_array:
|
||||
raise_error = False
|
||||
array = search_array_check(options.search_array)
|
||||
|
||||
if options.start and options.end:
|
||||
fmt = '%m/%d/%Y'
|
||||
date_rng = {
|
||||
'start_y': datetime.datetime
|
||||
.strptime(options.start, fmt)
|
||||
.timetuple()
|
||||
.tm_year,
|
||||
'start_jd': datetime.datetime
|
||||
.strptime(options.start, fmt)
|
||||
.timetuple().tm_yday,
|
||||
'end_y': datetime.datetime
|
||||
.strptime(options.end, fmt)
|
||||
.timetuple().tm_year,
|
||||
'end_jd': datetime.datetime
|
||||
.strptime(options.end, fmt)
|
||||
.timetuple().tm_yday
|
||||
}
|
||||
|
||||
gs = GsHelper(landsat_util.settings)
|
||||
gs.download(gs.search(array, date_rng))
|
||||
|
||||
if gs.found > 0:
|
||||
gs.unzip()
|
||||
print "%s images were downloaded and unzipped!" % gs.found
|
||||
exit("Your unzipped images are located here: %s" % gs.unzip_dir)
|
||||
else:
|
||||
exit("No Images found. Change your search parameters.")
|
||||
|
||||
if options.shapefile:
|
||||
raise_error = False
|
||||
clipper = Clipper()
|
||||
clipper.shapefile(options.shapefile)
|
||||
exit("Shapefile clipped")
|
||||
|
||||
if options.country:
|
||||
raise_error = False
|
||||
clipper = Clipper()
|
||||
clipper.country(options.country)
|
||||
exit("Process Completed")
|
||||
|
||||
if options.umeta:
|
||||
raise_error = False
|
||||
meta = Metadata()
|
||||
print 'Starting Metadata Update using Elastic Search ...\n'
|
||||
meta.populate()
|
||||
|
||||
if raise_error:
|
||||
exit('You must specify an argument. Use landsat_util --help for ' +
|
||||
'more info')
|
||||
|
||||
|
||||
def exit(message):
|
||||
print message
|
||||
sys.exit()
|
||||
|
||||
|
||||
def search_array_check(search_array):
|
||||
"""
|
||||
Turn the search text into paired groups of two
|
||||
"""
|
||||
array = search_array.split(',')
|
||||
paired = []
|
||||
for i in xrange(0, len(array), 2):
|
||||
paired.append(array[i:i + 2])
|
||||
|
||||
return paired
|
||||
|
||||
|
||||
def package_installed(package):
|
||||
"""
|
||||
Check if a package is installed on the machine
|
||||
"""
|
||||
|
||||
print "Checking if %s is installed on the system" % package
|
||||
installed = not subprocess.call(["which", package])
|
||||
if installed:
|
||||
print "%s is installed" % package
|
||||
return True
|
||||
else:
|
||||
print "You have to install %s first!" % package
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1 +0,0 @@
|
||||
from __future__ import absolute_import
|
||||
@@ -1,107 +0,0 @@
|
||||
# USGS Landsat Imagery Util
|
||||
#
|
||||
#
|
||||
# Author: developmentseed
|
||||
# Contributer: scisco
|
||||
#
|
||||
# License: CC0 1.0 Universal
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
import landsat_util.ogr2ogr
|
||||
import landsat_util.settings
|
||||
import landsat_util.ogrinfo
|
||||
from landsat_util.general_helper import Capturing, check_create_folder
|
||||
|
||||
# creates new input-shp.shp and ASSIGNS spatial reference system
|
||||
# ogr2ogr.main(['', '-a_srs', 'EPSG:4326', 'custom-sh-copy.shp',
|
||||
# '%s/draft-scripts/sample/custom-test.shp' % settings.BASE_DIR])
|
||||
|
||||
|
||||
class Clipper(object):
|
||||
|
||||
def __init__(self):
|
||||
self.assests_dir = landsat_util.settings.ASSESTS_DIR
|
||||
self.shapefile_output = landsat_util.settings.SHAPEFILE_OUTPUT
|
||||
self.shapefile_input = landsat_util.settings.SHAPEFILE_INPUT
|
||||
|
||||
check_create_folder(self.shapefile_input)
|
||||
check_create_folder(self.shapefile_output)
|
||||
|
||||
def shapefile(self, file):
|
||||
self.__srs_adjustment(file, 'a')
|
||||
self.__srs_adjustment(file, 't')
|
||||
self.__clip_shapefile(file)
|
||||
self.__generate_path_row('landsat-tiles.shp', 'landsat-tiles')
|
||||
|
||||
def country(self, name):
|
||||
self.__extract_country(name)
|
||||
self.__clip_shapefile('country.shp')
|
||||
self.__generate_path_row('landsat-tiles.shp', 'landsat-tiles')
|
||||
|
||||
def __srs_adjustment(self, file, load='a', type='EPSG:4326'):
|
||||
print "Executing SRS adjustments"
|
||||
|
||||
input = '%s/%s' % (self.shapefile_input, file)
|
||||
output = '%s/%s' % (self.shapefile_output, file)
|
||||
argv = ['', '-%s_srs' % load, type, os.path.dirname(output), input]
|
||||
|
||||
if os.path.isfile(output):
|
||||
input = output
|
||||
argv.insert(1, '-overwrite')
|
||||
|
||||
landsat_util.ogr2ogr.main(argv)
|
||||
|
||||
def __extract_country(self, name):
|
||||
print "Extracting the country"
|
||||
|
||||
input = '%s/ne_50m_admin_0_countries/ne_50m_admin_0_countries.shp' % \
|
||||
self.assests_dir
|
||||
output = '%s/country.shp' % self.shapefile_output
|
||||
argv = ['', '-where', 'admin like "%s" or adm0_a3 like "%s"' %
|
||||
(name, name), output, input]
|
||||
|
||||
if os.path.isfile(output):
|
||||
argv.insert(1, '-overwrite')
|
||||
|
||||
landsat_util.ogr2ogr.main(argv)
|
||||
|
||||
def __clip_shapefile(self, file):
|
||||
print "Clipping the shapefile"
|
||||
|
||||
clipper = '%s/%s' % (self.shapefile_output, file)
|
||||
output = '%s/landsat-tiles.shp' % self.shapefile_output
|
||||
input = '%s/wrs2_descending/wrs2_descending.shp' % self.assests_dir
|
||||
argv = ['', '-clipsrc', clipper, output, input]
|
||||
|
||||
if os.path.isfile(output):
|
||||
argv.insert(1, '-overwrite')
|
||||
|
||||
landsat_util.ogr2ogr.main(argv)
|
||||
|
||||
def __generate_path_row(self, source, layer=''):
|
||||
print "Generating paths and rows"
|
||||
|
||||
source = self.shapefile_output + '/' + source
|
||||
with Capturing() as output:
|
||||
landsat_util.ogrinfo.main(
|
||||
['',
|
||||
'-sql',
|
||||
'SELECT PATH, ROW FROM "%s"' % layer, source, layer
|
||||
])
|
||||
|
||||
# Convert the above output into a list with rows and paths
|
||||
rp = [re.sub(r'([A-Z]|[a-z]|\s|\(|\)|\'|\"|=|,|:|\.0|\.)', '', a)
|
||||
for a in str(output).split(',') if 'ROW' in a or 'PATH' in a]
|
||||
for k, v in enumerate(rp):
|
||||
if len(v) == 1:
|
||||
rp[k] = '00%s' % v
|
||||
elif len(v) == 2:
|
||||
rp[k] = '0%s' % v
|
||||
|
||||
s = open('%s/rows_paths.txt' % (self.shapefile_output), 'w')
|
||||
s.write(','.join(rp))
|
||||
s.close()
|
||||
|
||||
print ','.join(rp)
|
||||
@@ -1,39 +0,0 @@
|
||||
# USGS Landsat Imagery Util
|
||||
#
|
||||
#
|
||||
# Author: developmentseed
|
||||
# Contributer: scisco
|
||||
#
|
||||
# License: CC0 1.0 Universal
|
||||
|
||||
import os
|
||||
import sys
|
||||
from cStringIO import StringIO
|
||||
|
||||
|
||||
class Capturing(list):
|
||||
|
||||
def __enter__(self):
|
||||
self._stdout = sys.stdout
|
||||
sys.stdout = self._stringio = StringIO()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.extend(self._stringio.getvalue().splitlines())
|
||||
sys.stdout = self._stdout
|
||||
|
||||
|
||||
def check_create_folder(folder_path):
|
||||
if not os.path.exists(folder_path):
|
||||
os.makedirs(folder_path)
|
||||
print "%s folder created" % folder_path
|
||||
|
||||
return folder_path
|
||||
|
||||
|
||||
def get_file(path):
|
||||
return os.path.basename(path)
|
||||
|
||||
|
||||
def get_filename(path):
|
||||
return os.path.splitext(get_file(path))[0]
|
||||
@@ -1,150 +0,0 @@
|
||||
# USGS Landsat Imagery Util
|
||||
#
|
||||
#
|
||||
# Author: developmentseed
|
||||
# Contributer: scisco
|
||||
#
|
||||
# License: CC0 1.0 Universal
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from zipfile import ZipFile
|
||||
import tarfile
|
||||
|
||||
from landsat_util.general_helper import check_create_folder
|
||||
|
||||
|
||||
class GsHelper(object):
|
||||
|
||||
def __init__(self, settings):
|
||||
self.scene_file_url = settings.SCENE_FILE_URL
|
||||
self.download_dir = settings.DOWNLOAD_DIR
|
||||
self.zip_dir = settings.ZIP_DIR
|
||||
self.unzip_dir = settings.UNZIP_DIR
|
||||
self.scene_file = settings.SCENE_FILE
|
||||
|
||||
# Keep the number of images found on Google search
|
||||
# based on the search parameters
|
||||
self.found = 0
|
||||
|
||||
check_create_folder(self.download_dir)
|
||||
|
||||
#################
|
||||
# Public Methods
|
||||
#################
|
||||
|
||||
def search(self, query, date_rng):
|
||||
files = []
|
||||
self.__fetch_gs_scence_list()
|
||||
file = open(self.scene_file, 'r')
|
||||
# for q in query:
|
||||
# print date_rng
|
||||
files.extend(
|
||||
self.__search_scene_list(scene=file,
|
||||
query=query,
|
||||
date_rng=date_rng))
|
||||
|
||||
return files
|
||||
|
||||
def download(self, image_list):
|
||||
self.__download_images(image_list)
|
||||
|
||||
def unzip(self):
|
||||
self.__unzip_images()
|
||||
|
||||
#################
|
||||
# Private Methods
|
||||
#################
|
||||
|
||||
def __fetch_gs_scence_list(self):
|
||||
|
||||
if not os.path.isfile(self.scene_file):
|
||||
# Download the file
|
||||
subprocess.call(
|
||||
["gsutil", "cp", "-n",
|
||||
self.scene_file_url, "%s.zip" % self.scene_file])
|
||||
|
||||
# Unzip the file
|
||||
zip = ZipFile('%s.zip' % self.scene_file, 'r')
|
||||
zip.extractall(path=self.download_dir)
|
||||
zip.close()
|
||||
|
||||
print "scene_file unziped"
|
||||
|
||||
# return open(self.scene_file, 'r')
|
||||
|
||||
def __search_scene_list(self, scene, query, date_rng=None):
|
||||
"""
|
||||
Search scene_list for the provide rows, paths and date range.
|
||||
date_rng is a dictionary in this format:
|
||||
{
|
||||
'start_y': 2014, #year
|
||||
'start_jd': 13, #Julian Day
|
||||
'end_y': 2014,
|
||||
'end_jd': 15, #Julian Day
|
||||
}
|
||||
"""
|
||||
|
||||
file_list = []
|
||||
|
||||
scene.seek(0)
|
||||
for line in scene:
|
||||
url = line.split('/')
|
||||
file_name = url[len(url) - 1]
|
||||
f_query = [file_name[3:6], file_name[6:9]]
|
||||
jd = int(file_name[13:16].lstrip('0')) # Julian Day
|
||||
year = int(file_name[9:13])
|
||||
|
||||
if f_query in query:
|
||||
if date_rng:
|
||||
if year >= date_rng['start_y'] and \
|
||||
year <= date_rng['end_y'] and \
|
||||
jd >= date_rng['start_jd'] and \
|
||||
jd <= date_rng['end_jd']:
|
||||
file_list.append(line.replace('\n', ''))
|
||||
self.found += 1
|
||||
else:
|
||||
file_list.append(line.replace('\n', ''))
|
||||
self.found += 1
|
||||
|
||||
print "Search completed! %s images found." % self.found
|
||||
return file_list
|
||||
|
||||
def __download_images(self, files):
|
||||
|
||||
check_create_folder(self.zip_dir)
|
||||
|
||||
if self.found > 0:
|
||||
print "Downloading %s files from Google Storage..." % self.found
|
||||
|
||||
for url in files:
|
||||
url_brk = url.split('/')
|
||||
image_name = url_brk[len(url_brk) - 1]
|
||||
subprocess.call(
|
||||
["gsutil", "cp", "-n", url,
|
||||
"%s/%s" % (self.zip_dir, image_name)])
|
||||
|
||||
def __unzip_images(self):
|
||||
images = os.listdir(self.zip_dir)
|
||||
check_create_folder(self.unzip_dir)
|
||||
|
||||
for image in images:
|
||||
# Get the image name for creating folder
|
||||
image_name = image.split('.')
|
||||
|
||||
if image_name[0] and self.__check_if_not_unzipped(image_name[0]):
|
||||
# Create folder
|
||||
check_create_folder('%s/%s' % (self.unzip_dir, image_name[0]))
|
||||
|
||||
print "Unzipping %s ...be patient!" % image
|
||||
# Unzip
|
||||
tar = tarfile.open('%s/%s' % (self.zip_dir, image))
|
||||
tar.extractall(path='%s/%s' % (self.unzip_dir, image_name[0]))
|
||||
tar.close()
|
||||
|
||||
def __check_if_not_unzipped(self, folder_name):
|
||||
if os.path.exists('%s/%s' % (self.unzip_dir, folder_name)):
|
||||
print "%s is already unzipped" % folder_name
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -1,152 +0,0 @@
|
||||
# USGS Landsat Imagery Util
|
||||
#
|
||||
#
|
||||
# Author: developmentseed
|
||||
# Contributer: scisco
|
||||
#
|
||||
# License: CC0 1.0 Universal
|
||||
|
||||
#
|
||||
# This is intended to populate an Elastic Search instance.
|
||||
# For this file to work, you must make sure that you have a running instnace
|
||||
# of Elastic Search and it is setup in the settings.py
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import json
|
||||
from urllib2 import urlopen, HTTPError, URLError
|
||||
|
||||
|
||||
from elasticsearch import Elasticsearch
|
||||
from elasticsearch.exceptions import ConnectionError
|
||||
|
||||
from landsat_util import settings
|
||||
|
||||
|
||||
class Metadata(object):
|
||||
|
||||
def __init__(self):
|
||||
self.l8_metadata_filename = settings.L8_METADATA_FILENAME
|
||||
self.l8_metadata_url = settings.L8_METADATA_URL
|
||||
self.assests_dir = settings.ASSESTS_DIR
|
||||
self.es_url = settings.ES_URL
|
||||
self.es_main_index = settings.ES_MAIN_INDEX
|
||||
self.es_main_type = settings.ES_MAIN_TYPE
|
||||
|
||||
def populate(self):
|
||||
if self.download():
|
||||
es = Elasticsearch(self.es_url)
|
||||
|
||||
f = open('%s/%s' % (self.assests_dir, self.l8_metadata_filename),
|
||||
'r')
|
||||
# Read the first line for all the headers
|
||||
headers = f.readline().split(',')
|
||||
|
||||
# Read the rest of the document
|
||||
rows = f.readlines()
|
||||
added_counter = 0
|
||||
skipped_counter = 0
|
||||
for row in rows:
|
||||
fields = row.split(',')
|
||||
obj = {}
|
||||
for header in headers:
|
||||
try:
|
||||
obj[header.replace('\n', '')] = float(fields[
|
||||
headers.index(header)].replace('\n', ''))
|
||||
except ValueError:
|
||||
obj[header.replace('\n', '')] = fields[
|
||||
headers.index(header)].replace('\n', '')
|
||||
try:
|
||||
if not es.exists(
|
||||
index=self.es_main_index,
|
||||
doc_type=self.es_main_type,
|
||||
id=obj['sceneID']):
|
||||
es.create(
|
||||
index=self.es_main_index,
|
||||
doc_type=self.es_main_type,
|
||||
id=obj['sceneID'],
|
||||
body=json.dumps(obj),
|
||||
ignore=409)
|
||||
# print('%s-%s created' % (counter, obj['sceneID']))
|
||||
added_counter += 1
|
||||
print('%s new records added' % added_counter,
|
||||
end='\r')
|
||||
else:
|
||||
skipped_counter += 1
|
||||
|
||||
# New meta data is added to the top of the document.
|
||||
# When the script starts to see existing records, it means
|
||||
# that all new records are added and it's safe to break
|
||||
# the loop.
|
||||
if skipped_counter > 10:
|
||||
break
|
||||
|
||||
except ConnectionError:
|
||||
print('There was a connection error. Check your Elastic' +
|
||||
' Search setting and make sure Elastic Search is' +
|
||||
'running.')
|
||||
sys.exit(0)
|
||||
except:
|
||||
print('An expected error: %s' % (sys.exc_info()[0]))
|
||||
sys.exit(0)
|
||||
|
||||
print('The update is completed. %s new records were added.' %
|
||||
added_counter)
|
||||
|
||||
def download(self):
|
||||
|
||||
# Open the url
|
||||
try:
|
||||
f = urlopen(self.l8_metadata_url)
|
||||
if self.file_is_csv(f):
|
||||
print("downloading " + self.l8_metadata_url)
|
||||
CHUNK = 800 * 1024
|
||||
|
||||
counter = 0
|
||||
total_size = self.get_url_file_size(f)
|
||||
# Open our local file for writing
|
||||
with open('%s/%s' % (self.assests_dir,
|
||||
self.l8_metadata_filename),
|
||||
"wb") as meta_file:
|
||||
while True:
|
||||
chunk = f.read(CHUNK)
|
||||
if not chunk:
|
||||
break
|
||||
|
||||
meta_file.write(chunk)
|
||||
counter += 1
|
||||
chunk_sum = float(counter * CHUNK)
|
||||
perct = chunk_sum / total_size
|
||||
print('==> download progress: {:.2%}'.format(perct),
|
||||
end='\r')
|
||||
sys.stdout.flush()
|
||||
|
||||
print('==> Download completed')
|
||||
|
||||
return True
|
||||
else:
|
||||
print('The URL provided doesn\'t include a CSV file')
|
||||
return False
|
||||
|
||||
# handle errors
|
||||
except HTTPError, e:
|
||||
print("HTTP Error:", e.code, self.l8_metadata_url)
|
||||
except URLError, e:
|
||||
print("URL Error:", e.reason, self.l8_metadata_url)
|
||||
|
||||
return False
|
||||
|
||||
def get_url_file_size(self, remote_file):
|
||||
"""gets filesize of remote file"""
|
||||
|
||||
size = remote_file.headers.get('content-length')
|
||||
return float(size)
|
||||
|
||||
def file_is_csv(self, remote_file):
|
||||
"""Checks whether the file is CSV"""
|
||||
|
||||
if 'csv' in remote_file.headers.get('content-type'):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,532 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#/******************************************************************************
|
||||
# * $Id$
|
||||
# *
|
||||
# * Project: OpenGIS Simple Features Reference Implementation
|
||||
# * Purpose: Python port of a simple client for viewing OGR driver data.
|
||||
# * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
|
||||
# *
|
||||
# * Port from ogrinfo.cpp whose author is Frank Warmerdam
|
||||
# *
|
||||
# ******************************************************************************
|
||||
# * Copyright (c) 2010-2013, Even Rouault <even dot rouault at mines-paris dot org>
|
||||
# * Copyright (c) 1999, Frank Warmerdam
|
||||
# *
|
||||
# * Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# * copy of this software and associated documentation files (the "Software"),
|
||||
# * to deal in the Software without restriction, including without limitation
|
||||
# * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# * and/or sell copies of the Software, and to permit persons to whom the
|
||||
# * Software is furnished to do so, subject to the following conditions:
|
||||
# *
|
||||
# * The above copyright notice and this permission notice shall be included
|
||||
# * in all copies or substantial portions of the Software.
|
||||
# *
|
||||
# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# * DEALINGS IN THE SOFTWARE.
|
||||
# ****************************************************************************/
|
||||
|
||||
# Note : this is the most direct port of ogrinfo.cpp possible
|
||||
# It could be made much more Python'ish !
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from osgeo import gdal
|
||||
from osgeo import ogr
|
||||
except:
|
||||
import gdal
|
||||
import ogr
|
||||
|
||||
bReadOnly = False
|
||||
bVerbose = True
|
||||
bSummaryOnly = False
|
||||
nFetchFID = ogr.NullFID
|
||||
papszOptions = None
|
||||
|
||||
def EQUAL(a, b):
|
||||
return a.lower() == b.lower()
|
||||
|
||||
#/************************************************************************/
|
||||
#/* main() */
|
||||
#/************************************************************************/
|
||||
|
||||
def main(argv = None):
|
||||
|
||||
global bReadOnly
|
||||
global bVerbose
|
||||
global bSummaryOnly
|
||||
global nFetchFID
|
||||
global papszOptions
|
||||
|
||||
pszWHERE = None
|
||||
pszDataSource = None
|
||||
papszLayers = None
|
||||
poSpatialFilter = None
|
||||
nRepeatCount = 1
|
||||
bAllLayers = False
|
||||
pszSQLStatement = None
|
||||
pszDialect = None
|
||||
options = {}
|
||||
pszGeomField = None
|
||||
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
||||
argv = ogr.GeneralCmdLineProcessor( argv )
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Processing command line arguments. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
if argv is None:
|
||||
return 1
|
||||
|
||||
nArgc = len(argv)
|
||||
|
||||
iArg = 1
|
||||
while iArg < nArgc:
|
||||
|
||||
if EQUAL(argv[iArg],"--utility_version"):
|
||||
print("%s is running against GDAL %s" %
|
||||
(argv[0], gdal.VersionInfo("RELEASE_NAME")))
|
||||
return 0
|
||||
|
||||
elif EQUAL(argv[iArg],"-ro"):
|
||||
bReadOnly = True
|
||||
elif EQUAL(argv[iArg],"-q") or EQUAL(argv[iArg],"-quiet"):
|
||||
bVerbose = False
|
||||
elif EQUAL(argv[iArg],"-fid") and iArg < nArgc-1:
|
||||
iArg = iArg + 1
|
||||
nFetchFID = int(argv[iArg])
|
||||
elif EQUAL(argv[iArg],"-spat") and iArg + 4 < nArgc:
|
||||
oRing = ogr.Geometry(ogr.wkbLinearRing)
|
||||
|
||||
oRing.AddPoint( float(argv[iArg+1]), float(argv[iArg+2]) )
|
||||
oRing.AddPoint( float(argv[iArg+1]), float(argv[iArg+4]) )
|
||||
oRing.AddPoint( float(argv[iArg+3]), float(argv[iArg+4]) )
|
||||
oRing.AddPoint( float(argv[iArg+3]), float(argv[iArg+2]) )
|
||||
oRing.AddPoint( float(argv[iArg+1]), float(argv[iArg+2]) )
|
||||
|
||||
poSpatialFilter = ogr.Geometry(ogr.wkbPolygon)
|
||||
poSpatialFilter.AddGeometry(oRing)
|
||||
iArg = iArg + 4
|
||||
|
||||
elif EQUAL(argv[iArg],"-geomfield") and iArg < nArgc-1:
|
||||
iArg = iArg + 1
|
||||
pszGeomField = argv[iArg]
|
||||
|
||||
elif EQUAL(argv[iArg],"-where") and iArg < nArgc-1:
|
||||
iArg = iArg + 1
|
||||
pszWHERE = argv[iArg]
|
||||
|
||||
elif EQUAL(argv[iArg],"-sql") and iArg < nArgc-1:
|
||||
iArg = iArg + 1
|
||||
pszSQLStatement = argv[iArg]
|
||||
|
||||
elif EQUAL(argv[iArg],"-dialect") and iArg < nArgc-1:
|
||||
iArg = iArg + 1
|
||||
pszDialect = argv[iArg]
|
||||
|
||||
elif EQUAL(argv[iArg],"-rc") and iArg < nArgc-1:
|
||||
iArg = iArg + 1
|
||||
nRepeatCount = int(argv[iArg])
|
||||
|
||||
elif EQUAL(argv[iArg],"-al"):
|
||||
bAllLayers = True
|
||||
|
||||
elif EQUAL(argv[iArg],"-so") or EQUAL(argv[iArg],"-summary"):
|
||||
bSummaryOnly = True
|
||||
|
||||
elif len(argv[iArg]) > 8 and EQUAL(argv[iArg][0:8],"-fields="):
|
||||
options['DISPLAY_FIELDS'] = argv[iArg][7:len(argv[iArg])]
|
||||
|
||||
elif len(argv[iArg]) > 6 and EQUAL(argv[iArg][0:6],"-geom="):
|
||||
options['DISPLAY_GEOMETRY'] = argv[iArg][6:len(argv[iArg])]
|
||||
|
||||
elif argv[iArg][0] == '-':
|
||||
return Usage()
|
||||
|
||||
elif pszDataSource is None:
|
||||
pszDataSource = argv[iArg]
|
||||
else:
|
||||
if papszLayers is None:
|
||||
papszLayers = []
|
||||
papszLayers.append( argv[iArg] )
|
||||
bAllLayers = False
|
||||
|
||||
iArg = iArg + 1
|
||||
|
||||
if pszDataSource is None:
|
||||
return Usage()
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Open data source. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
poDS = None
|
||||
poDriver = None
|
||||
|
||||
poDS = ogr.Open( pszDataSource, not bReadOnly )
|
||||
if poDS is None and not bReadOnly:
|
||||
poDS = ogr.Open( pszDataSource, False )
|
||||
if poDS is not None and bVerbose:
|
||||
print( "Had to open data source read-only." )
|
||||
bReadOnly = True
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Report failure */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
if poDS is None:
|
||||
print( "FAILURE:\n"
|
||||
"Unable to open datasource `%s' with the following drivers." % pszDataSource )
|
||||
|
||||
for iDriver in range(ogr.GetDriverCount()):
|
||||
print( " -> %s" % ogr.GetDriver(iDriver).GetName() )
|
||||
|
||||
return 1
|
||||
|
||||
poDriver = poDS.GetDriver()
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Some information messages. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
if bVerbose:
|
||||
print( "INFO: Open of `%s'\n"
|
||||
" using driver `%s' successful." % (pszDataSource, poDriver.GetName()) )
|
||||
|
||||
poDS_Name = poDS.GetName()
|
||||
if str(type(pszDataSource)) == "<type 'unicode'>" and str(type(poDS_Name)) == "<type 'str'>":
|
||||
poDS_Name = unicode(poDS_Name, "utf8")
|
||||
if bVerbose and pszDataSource != poDS_Name:
|
||||
print( "INFO: Internal data source name `%s'\n"
|
||||
" different from user name `%s'." % (poDS_Name, pszDataSource ))
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Special case for -sql clause. No source layers required. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
if pszSQLStatement is not None:
|
||||
poResultSet = None
|
||||
|
||||
nRepeatCount = 0 #// skip layer reporting.
|
||||
|
||||
if papszLayers is not None:
|
||||
print( "layer names ignored in combination with -sql." )
|
||||
|
||||
if pszGeomField is None:
|
||||
poResultSet = poDS.ExecuteSQL( pszSQLStatement, poSpatialFilter,
|
||||
pszDialect )
|
||||
else:
|
||||
poResultSet = poDS.ExecuteSQL( pszSQLStatement, None, pszDialect )
|
||||
|
||||
if poResultSet is not None:
|
||||
if pszWHERE is not None:
|
||||
if poResultSet.SetAttributeFilter( pszWHERE ) != 0:
|
||||
print("FAILURE: SetAttributeFilter(%s) failed." % pszWHERE)
|
||||
return 1
|
||||
|
||||
if pszGeomField is not None:
|
||||
ReportOnLayer( poResultSet, None, pszGeomField, poSpatialFilter, options )
|
||||
else:
|
||||
ReportOnLayer( poResultSet, None, None, None, options )
|
||||
poDS.ReleaseResultSet( poResultSet )
|
||||
|
||||
#gdal.Debug( "OGR", "GetLayerCount() = %d\n", poDS.GetLayerCount() )
|
||||
|
||||
for iRepeat in range(nRepeatCount):
|
||||
if papszLayers is None:
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Process each data source layer. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
for iLayer in range(poDS.GetLayerCount()):
|
||||
poLayer = poDS.GetLayer(iLayer)
|
||||
|
||||
if poLayer is None:
|
||||
print( "FAILURE: Couldn't fetch advertised layer %d!" % iLayer )
|
||||
return 1
|
||||
|
||||
if not bAllLayers:
|
||||
line = "%d: %s" % (iLayer+1, poLayer.GetLayerDefn().GetName())
|
||||
|
||||
nGeomFieldCount = poLayer.GetLayerDefn().GetGeomFieldCount()
|
||||
if nGeomFieldCount > 1:
|
||||
line = line + " ("
|
||||
for iGeom in range(nGeomFieldCount):
|
||||
if iGeom > 0:
|
||||
line = line + ", "
|
||||
poGFldDefn = poLayer.GetLayerDefn().GetGeomFieldDefn(iGeom)
|
||||
line = line + "%s" % ogr.GeometryTypeToName( poGFldDefn.GetType() )
|
||||
line = line + ")"
|
||||
|
||||
if poLayer.GetLayerDefn().GetGeomType() != ogr.wkbUnknown:
|
||||
line = line + " (%s)" % ogr.GeometryTypeToName( poLayer.GetLayerDefn().GetGeomType() )
|
||||
|
||||
print(line)
|
||||
else:
|
||||
if iRepeat != 0:
|
||||
poLayer.ResetReading()
|
||||
|
||||
ReportOnLayer( poLayer, pszWHERE, pszGeomField, poSpatialFilter, options )
|
||||
|
||||
else:
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Process specified data source layers. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
for papszIter in papszLayers:
|
||||
poLayer = poDS.GetLayerByName(papszIter)
|
||||
|
||||
if poLayer is None:
|
||||
print( "FAILURE: Couldn't fetch requested layer %s!" % papszIter )
|
||||
return 1
|
||||
|
||||
if iRepeat != 0:
|
||||
poLayer.ResetReading()
|
||||
|
||||
ReportOnLayer( poLayer, pszWHERE, pszGeomField, poSpatialFilter, options )
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Close down. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
poDS.Destroy()
|
||||
|
||||
return 0
|
||||
|
||||
#/************************************************************************/
|
||||
#/* Usage() */
|
||||
#/************************************************************************/
|
||||
|
||||
def Usage():
|
||||
|
||||
print( "Usage: ogrinfo [--help-general] [-ro] [-q] [-where restricted_where]\n"
|
||||
" [-spat xmin ymin xmax ymax] [-geomfield field] [-fid fid]\n"
|
||||
" [-sql statement] [-al] [-so] [-fields={YES/NO}]\n"
|
||||
" [-geom={YES/NO/SUMMARY}][--formats]\n"
|
||||
" datasource_name [layer [layer ...]]")
|
||||
return 1
|
||||
|
||||
#/************************************************************************/
|
||||
#/* ReportOnLayer() */
|
||||
#/************************************************************************/
|
||||
|
||||
def ReportOnLayer( poLayer, pszWHERE, pszGeomField, poSpatialFilter, options ):
|
||||
|
||||
poDefn = poLayer.GetLayerDefn()
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Set filters if provided. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
if pszWHERE is not None:
|
||||
if poLayer.SetAttributeFilter( pszWHERE ) != 0:
|
||||
print("FAILURE: SetAttributeFilter(%s) failed." % pszWHERE)
|
||||
return
|
||||
|
||||
if poSpatialFilter is not None:
|
||||
if pszGeomField is not None:
|
||||
iGeomField = poLayer.GetLayerDefn().GetGeomFieldIndex(pszGeomField)
|
||||
if iGeomField >= 0:
|
||||
poLayer.SetSpatialFilter( iGeomField, poSpatialFilter )
|
||||
else:
|
||||
print("WARNING: Cannot find geometry field %s." % pszGeomField)
|
||||
else:
|
||||
poLayer.SetSpatialFilter( poSpatialFilter )
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Report various overall information. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
print( "" )
|
||||
|
||||
print( "Layer name: %s" % poDefn.GetName() )
|
||||
|
||||
if bVerbose:
|
||||
nGeomFieldCount = poLayer.GetLayerDefn().GetGeomFieldCount()
|
||||
if nGeomFieldCount > 1:
|
||||
for iGeom in range(nGeomFieldCount):
|
||||
poGFldDefn = poLayer.GetLayerDefn().GetGeomFieldDefn(iGeom)
|
||||
print( "Geometry (%s): %s" % (poGFldDefn.GetNameRef(), ogr.GeometryTypeToName( poGFldDefn.GetType() ) ))
|
||||
else:
|
||||
print( "Geometry: %s" % ogr.GeometryTypeToName( poDefn.GetGeomType() ) )
|
||||
|
||||
print( "Feature Count: %d" % poLayer.GetFeatureCount() )
|
||||
|
||||
if nGeomFieldCount > 1:
|
||||
for iGeom in range(nGeomFieldCount):
|
||||
poGFldDefn = poLayer.GetLayerDefn().GetGeomFieldDefn(iGeom)
|
||||
oExt = poLayer.GetExtent(True, geom_field = iGeom, can_return_null = True)
|
||||
if oExt is not None:
|
||||
print("Extent (%s): (%f, %f) - (%f, %f)" % (poGFldDefn.GetNameRef(), oExt[0], oExt[2], oExt[1], oExt[3]))
|
||||
else:
|
||||
oExt = poLayer.GetExtent(True, can_return_null = True)
|
||||
if oExt is not None:
|
||||
print("Extent: (%f, %f) - (%f, %f)" % (oExt[0], oExt[2], oExt[1], oExt[3]))
|
||||
|
||||
if nGeomFieldCount > 1:
|
||||
for iGeom in range(nGeomFieldCount):
|
||||
poGFldDefn = poLayer.GetLayerDefn().GetGeomFieldDefn(iGeom)
|
||||
if poGFldDefn.GetSpatialRef() is None:
|
||||
pszWKT = "(unknown)"
|
||||
else:
|
||||
pszWKT = poGFldDefn.GetSpatialRef().ExportToPrettyWkt()
|
||||
print( "SRS WKT (%s):\n%s" % (poGFldDefn.GetNameRef(), pszWKT) )
|
||||
else:
|
||||
if poLayer.GetSpatialRef() is None:
|
||||
pszWKT = "(unknown)"
|
||||
else:
|
||||
pszWKT = poLayer.GetSpatialRef().ExportToPrettyWkt()
|
||||
print( "Layer SRS WKT:\n%s" % pszWKT )
|
||||
|
||||
if len(poLayer.GetFIDColumn()) > 0:
|
||||
print( "FID Column = %s" % poLayer.GetFIDColumn() )
|
||||
|
||||
if nGeomFieldCount > 1:
|
||||
for iGeom in range(nGeomFieldCount):
|
||||
poGFldDefn = poLayer.GetLayerDefn().GetGeomFieldDefn(iGeom)
|
||||
print( "Geometry Column %d = %s" % (iGeom + 1, poGFldDefn.GetNameRef() ))
|
||||
else:
|
||||
if len(poLayer.GetGeometryColumn()) > 0:
|
||||
print( "Geometry Column = %s" % poLayer.GetGeometryColumn() )
|
||||
|
||||
for iAttr in range(poDefn.GetFieldCount()):
|
||||
poField = poDefn.GetFieldDefn( iAttr )
|
||||
|
||||
print( "%s: %s (%d.%d)" % ( \
|
||||
poField.GetNameRef(), \
|
||||
poField.GetFieldTypeName( poField.GetType() ), \
|
||||
poField.GetWidth(), \
|
||||
poField.GetPrecision() ))
|
||||
|
||||
#/* -------------------------------------------------------------------- */
|
||||
#/* Read, and dump features. */
|
||||
#/* -------------------------------------------------------------------- */
|
||||
poFeature = None
|
||||
|
||||
if nFetchFID == ogr.NullFID and not bSummaryOnly:
|
||||
|
||||
poFeature = poLayer.GetNextFeature()
|
||||
while poFeature is not None:
|
||||
DumpReadableFeature(poFeature, options)
|
||||
poFeature = poLayer.GetNextFeature()
|
||||
|
||||
elif nFetchFID != ogr.NullFID:
|
||||
|
||||
poFeature = poLayer.GetFeature( nFetchFID )
|
||||
if poFeature is None:
|
||||
print( "Unable to locate feature id %d on this layer." % nFetchFID )
|
||||
|
||||
else:
|
||||
DumpReadableFeature(poFeature, options)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def DumpReadableFeature( poFeature, options = None ):
|
||||
|
||||
poDefn = poFeature.GetDefnRef()
|
||||
print("OGRFeature(%s):%ld" % (poDefn.GetName(), poFeature.GetFID() ))
|
||||
|
||||
if 'DISPLAY_FIELDS' not in options or EQUAL(options['DISPLAY_FIELDS'], 'yes'):
|
||||
for iField in range(poDefn.GetFieldCount()):
|
||||
|
||||
poFDefn = poDefn.GetFieldDefn(iField)
|
||||
|
||||
line = " %s (%s) = " % ( \
|
||||
poFDefn.GetNameRef(), \
|
||||
ogr.GetFieldTypeName(poFDefn.GetType()) )
|
||||
|
||||
if poFeature.IsFieldSet( iField ):
|
||||
line = line + "%s" % (poFeature.GetFieldAsString( iField ) )
|
||||
else:
|
||||
line = line + "(null)"
|
||||
|
||||
print(line)
|
||||
|
||||
|
||||
if poFeature.GetStyleString() is not None:
|
||||
|
||||
if 'DISPLAY_STYLE' not in options or EQUAL(options['DISPLAY_STYLE'], 'yes'):
|
||||
print(" Style = %s" % GetStyleString() )
|
||||
|
||||
nGeomFieldCount = poFeature.GetGeomFieldCount()
|
||||
if nGeomFieldCount > 0:
|
||||
if 'DISPLAY_GEOMETRY' not in options or not EQUAL(options['DISPLAY_GEOMETRY'], 'no'):
|
||||
for iField in range(nGeomFieldCount):
|
||||
poGFldDefn = poFeature.GetDefnRef().GetGeomFieldDefn(iField)
|
||||
poGeometry = poFeature.GetGeomFieldRef(iField)
|
||||
if poGeometry is not None:
|
||||
sys.stdout.write(" ")
|
||||
if len(poGFldDefn.GetNameRef()) > 0 and nGeomFieldCount > 1:
|
||||
sys.stdout.write("%s = " % poGFldDefn.GetNameRef() )
|
||||
DumpReadableGeometry( poGeometry, "", options)
|
||||
|
||||
print('')
|
||||
|
||||
return
|
||||
|
||||
|
||||
def DumpReadableGeometry( poGeometry, pszPrefix, options ):
|
||||
|
||||
if pszPrefix == None:
|
||||
pszPrefix = ""
|
||||
|
||||
if 'DISPLAY_GEOMETRY' in options and EQUAL(options['DISPLAY_GEOMETRY'], 'SUMMARY'):
|
||||
|
||||
line = ("%s%s : " % (pszPrefix, poGeometry.GetGeometryName() ))
|
||||
eType = poGeometry.GetGeometryType()
|
||||
if eType == ogr.wkbLineString or eType == ogr.wkbLineString25D:
|
||||
line = line + ("%d points" % poGeometry.GetPointCount())
|
||||
print(line)
|
||||
elif eType == ogr.wkbPolygon or eType == ogr.wkbPolygon25D:
|
||||
nRings = poGeometry.GetGeometryCount()
|
||||
if nRings == 0:
|
||||
line = line + "empty"
|
||||
else:
|
||||
poRing = poGeometry.GetGeometryRef(0)
|
||||
line = line + ("%d points" % poRing.GetPointCount())
|
||||
if nRings > 1:
|
||||
line = line + (", %d inner rings (" % (nRings - 1))
|
||||
for ir in range(0,nRings-1):
|
||||
if ir > 0:
|
||||
line = line + ", "
|
||||
poRing = poGeometry.GetGeometryRef(ir+1)
|
||||
line = line + ("%d points" % poRing.GetPointCount())
|
||||
line = line + ")"
|
||||
print(line)
|
||||
|
||||
elif eType == ogr.wkbMultiPoint or \
|
||||
eType == ogr.wkbMultiPoint25D or \
|
||||
eType == ogr.wkbMultiLineString or \
|
||||
eType == ogr.wkbMultiLineString25D or \
|
||||
eType == ogr.wkbMultiPolygon or \
|
||||
eType == ogr.wkbMultiPolygon25D or \
|
||||
eType == ogr.wkbGeometryCollection or \
|
||||
eType == ogr.wkbGeometryCollection25D:
|
||||
|
||||
line = line + "%d geometries:" % poGeometry.GetGeometryCount()
|
||||
print(line)
|
||||
for ig in range(poGeometry.GetGeometryCount()):
|
||||
subgeom = poGeometry.GetGeometryRef(ig)
|
||||
from sys import version_info
|
||||
if version_info >= (3,0,0):
|
||||
exec('print("", end=" ")')
|
||||
else:
|
||||
exec('print "", ')
|
||||
DumpReadableGeometry( subgeom, pszPrefix, options)
|
||||
else:
|
||||
print(line)
|
||||
|
||||
elif 'DISPLAY_GEOMETRY' not in options or EQUAL(options['DISPLAY_GEOMETRY'], 'yes') \
|
||||
or EQUAL(options['DISPLAY_GEOMETRY'], 'WKT'):
|
||||
|
||||
print("%s%s" % (pszPrefix, poGeometry.ExportToWkt() ))
|
||||
|
||||
return
|
||||
|
||||
if __name__ == '__main__':
|
||||
version_num = int(gdal.VersionInfo('VERSION_NUM'))
|
||||
if version_num < 1800: # because of ogr.GetFieldTypeName
|
||||
print('ERROR: Python bindings of GDAL 1.8.0 or later required')
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(main( sys.argv ))
|
||||
@@ -1,44 +0,0 @@
|
||||
# USGS Landsat Imagery Util
|
||||
#
|
||||
#
|
||||
# Author: developmentseed
|
||||
# Contributer: scisco
|
||||
#
|
||||
# License: CC0 1.0 Universal
|
||||
|
||||
##
|
||||
## Main Setting File
|
||||
##
|
||||
|
||||
import os
|
||||
|
||||
# Google Storage Landsat Config
|
||||
|
||||
SOURCE_URL = 'gs://earthengine-public/landsat'
|
||||
SCENE_FILE_URL = SOURCE_URL + '/scene_list.zip'
|
||||
SATELLITE = 'L8'
|
||||
L8_METADATA_URL = 'http://landsat.usgs.gov/metadata_service/bulk_metadata_files/LANDSAT_8.csv'
|
||||
|
||||
# Elastic Search Config
|
||||
|
||||
ES_URL = [{
|
||||
'host': 'localhost',
|
||||
'port': 9200,
|
||||
'use_ssl': False
|
||||
}]
|
||||
ES_MAIN_INDEX = 'landsat'
|
||||
ES_MAIN_TYPE = '8'
|
||||
|
||||
# Local Forlders Config
|
||||
|
||||
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
||||
DOWNLOAD_DIR = BASE_DIR + '/output/imagery'
|
||||
ZIP_DIR = DOWNLOAD_DIR + '/zip'
|
||||
UNZIP_DIR = DOWNLOAD_DIR + '/unzip'
|
||||
SCENE_FILE = DOWNLOAD_DIR + '/scene_list'
|
||||
|
||||
ASSESTS_DIR = BASE_DIR + '/assests'
|
||||
L8_METADATA_FILENAME = 'metadata.csv'
|
||||
|
||||
SHAPEFILE_INPUT = BASE_DIR + '/output/shapefiles/input'
|
||||
SHAPEFILE_OUTPUT = BASE_DIR + '/output/shapefiles/output'
|
||||
Reference in New Issue
Block a user