forked from project-open-data/esri2open
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Calvin Metcalf
committed
Apr 25, 2013
1 parent
4f18caf
commit ae8096b
Showing
4 changed files
with
292 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
body { | |||
font-family: 'Helvetica'; | |||
letter-spacing:-5px; | |||
background:#000; | |||
background-size:100%; | |||
color:#fff; | |||
margin:0; | |||
padding:0; | |||
font-weight:bold; | |||
} | |||
|
|||
h1, h2, h3, p { | |||
margin:0; | |||
} | |||
|
|||
em, a { | |||
font-style:normal; | |||
color:#8dbd0c; | |||
} | |||
|
|||
a { | |||
background: #34d0e7; | |||
color:#000; | |||
text-decoration:none; | |||
} | |||
|
|||
img { | |||
width:100%; | |||
} | |||
|
|||
div { | |||
cursor:pointer; | |||
cursor:hand; | |||
position:absolute; | |||
top:0; | |||
left:0; | |||
} | |||
|
|||
.GreenDOT {background:#0f0;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,56 @@ | |||
window.onload = function() { | |||
var converter = new Showdown.converter(); | |||
var md = document.getElementById("md"); | |||
var html = converter.makeHtml(md.innerHTML); | |||
md.innerHTML = html.replace(/\<(\/)?p\>/g,'<$1div>'); | |||
var s = document.getElementsByTagName('div'), cur = 0; | |||
if (!s) return; | |||
function go(n) { | |||
cur = n; | |||
var i = 1e3, e = s[n]; | |||
for (var k = 0; k < s.length; k++) s[k].style.display = 'none'; | |||
e.style.display = 'inline'; | |||
e.style.fontSize = i + 'px'; | |||
if (e.firstChild.nodeName === 'IMG') { | |||
document.body.style.backgroundImage = 'url(' + e.firstChild.src + ')'; | |||
e.firstChild.style.display = 'none'; | |||
} else { | |||
document.body.style.backgroundImage = ''; | |||
document.body.style.backgroundColor = e.style.backgroundColor; | |||
} | |||
while ( | |||
e.offsetWidth > window.innerWidth || | |||
e.offsetHeight > window.innerHeight) { | |||
e.style.fontSize = (i -= 10) + 'px'; | |||
if (i < 0) break; | |||
} | |||
e.style.marginTop = ((window.innerHeight - e.offsetHeight) / 2) + 'px'; | |||
if (window.location.hash !== n) window.location.hash = n; | |||
document.title = e.textContent || e.innerText; | |||
} | |||
document.onclick = function() { | |||
go(++cur % (s.length)); | |||
}; | |||
document.onkeydown = function(e) { | |||
(e.which === 39) && go(Math.min(s.length - 1, ++cur)); | |||
(e.which === 37) && go(Math.max(0, --cur)); | |||
}; | |||
var xStart; | |||
md.addEventListener("touchstart",function(e){xStart = e.changedTouches[0].pageX}, false) | |||
md.addEventListener("touchend",function(e){var test = e.changedTouches[0].pageX-xStart; | |||
(test < 0) && go(Math.min(s.length - 1, ++cur)); | |||
(test > 0) && go(Math.max(0, --cur)); | |||
}, false) | |||
function parse_hash() { | |||
return Math.max(Math.min( | |||
s.length - 1, | |||
parseInt(window.location.hash.substring(1), 10)), 0); | |||
} | |||
if (window.location.hash) cur = parse_hash() || cur; | |||
window.onhashchange = function() { | |||
var c = parse_hash(); | |||
if (c !== cur) go(c); | |||
}; | |||
|
|||
go(cur); | |||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,135 @@ | |||
<!DOCTYPE html><html><head><title></title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /><link href='big.css' rel='stylesheet' type='text/css' /><script src='showdown.js'></script><script src='big.js'></script></head><body> | |||
<span id="md"> | |||
Convert ESRI to GeoJSON | |||
|
|||
so you have some data in SDE | |||
|
|||
and want to use it on the internet | |||
|
|||
_let's just use ArcGIS online..._ | |||
|
|||
said nobody | |||
|
|||
you want to use it in | |||
|
|||
![tilemill](http://mapbox.com/tilemill/img/hero-tilemill.png)_TileMill_ | |||
|
|||
or | |||
|
|||
![leaflet](http://farm9.staticflickr.com/8527/8680357801_712bc7e350_o_d.png)leaflet | |||
|
|||
And you like having fieldnames longer then 8 charicters | |||
|
|||
I'll just convert to geojson, it's similar right? | |||
|
|||
![differences](https://pbs.twimg.com/media/BF0YSy2CEAAJYcH.png:large)_no_ | |||
|
|||
ESRI has 4 geometry types | |||
|
|||
point | |||
|
|||
multipoint | |||
|
|||
polyline | |||
|
|||
polygon | |||
|
|||
GeoJSON has those | |||
|
|||
but calls them Point, MultiPoint, LineString, and Polygon | |||
|
|||
GeoJSON also has | |||
|
|||
MultiLineString, MultiPolygon, and GeometryCollection | |||
|
|||
ESRI a geometry type for the feature class and all features to have that or null | |||
|
|||
GeoJSON requires it to be anything except null | |||
|
|||
So I wrote an arcpy script to automate the export | |||
|
|||
and then got distracted after finishing 95% | |||
|
|||
But then | |||
|
|||
![Michael Byrne](https://secure.gravatar.com/avatar/b57972826b35359132d2952182aa0b0e?s=1200)Michael Byrnes started his | |||
|
|||
Now I MUST finish mine | |||
|
|||
and/or merge our efforts | |||
|
|||
anywho back to the point | |||
|
|||
that 5% I had left to solve | |||
|
|||
_inner rings_ | |||
|
|||
GeoJSON has an array with the first feature being the outer and the rest being the inner rings | |||
|
|||
ESRI has a bunch of points, some of them are null | |||
|
|||
you have to check the existence of eveyr point | |||
|
|||
![what inner rings think of you](http://farm9.staticflickr.com/8383/8680565639_7e37a973e0_o_d.png) | |||
|
|||
ESRI requires first and last point of a polygon to be the same | |||
|
|||
i.e. repeat point | |||
|
|||
_SO DOES GEOJSON FTW!!!1_ | |||
|
|||
ESRI allows polygones with a total of less then 4 points | |||
|
|||
NO SANE FRAMEWORK DOES THIS! | |||
|
|||
it also allows lines with only one point | |||
|
|||
which means you have polygons that could be lines or points | |||
|
|||
and lines that could be points | |||
|
|||
and while were at it, ESRI allows multi points with only one point | |||
|
|||
and makes no distinction between multi and regular for line and poly | |||
|
|||
but some parts of a single multipoly could be a line | |||
|
|||
and some a point | |||
|
|||
and some a poly | |||
|
|||
_solution_ | |||
|
|||
waterfall model | |||
|
|||
parsePolygone either returns geo or calls parseLinestring | |||
|
|||
etc with line->point | |||
|
|||
fallback to next type | |||
|
|||
and if a multi and mixed | |||
|
|||
_GeometryCollection FTW_ | |||
|
|||
of course going backwards | |||
|
|||
![geojson to esri](https://pbs.twimg.com/media/BF0btM5CIAUvXwC.png:large)_Have Fun_ | |||
|
|||
_fin_ | |||
|
|||
[github.com/calvinmetcalf/esri2open](https://github.com/calvinmetcalf/esri2open) | |||
[github.com/feomike/esri2open](https://github.com/feomike/esri2open) | |||
[calvinmetcalf.github.io/esri2open](http://calvinmetcalf.github.io/esri2open) | |||
[@cwmma](https://twitter.com/CWMma) | |||
</span> | |||
<script> | |||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |||
|
|||
ga('create', 'UA-40454900-1', 'github.io'); | |||
ga('send', 'pageview'); | |||
|
|||
</script> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.