Flutterby™! : status update

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

status update

2010-12-23 04:46:09.149794+00 by Dan Lyke 16 comments

Really? You have to guess at the projection of a .shp file? [Remainder of rant edited out for a family audience]

[ related topics: Sociology ]

comments in descending chronological order (reverse):

#Comment Re: made: 2010-12-28 17:04:20.038274+00 by: markd

Write once, run away.

#Comment Re: made: 2010-12-28 16:19:22.789754+00 by: meuon

And, of course, being Java, it appears to crash oddly on different platforms.

Or sometimes, crash oddly on the same platform. Sigh.

Re: WediaWiki - That is a code base that makes me cringe every time I have to fix something.

#Comment Re: made: 2010-12-28 15:51:36.104304+00 by: Dan Lyke

It could totally be bloat from Ubuntu's config, but teasing that apart versus just setting up LigHTTPD and converting a few things to FastCGI seems like a fool's game.

#Comment Re: made: 2010-12-28 03:12:30.705964+00 by: spc476

Are you sure it's not the bloat that comes with your distribution's Apache setup?

#Comment Re: made: 2010-12-28 01:48:04.774954+00 by: Dan Lyke

And, of course, being Java, it appears to crash oddly on different platforms.

#Comment Re: made: 2010-12-27 21:58:27.368581+00 by: markd

Well, the FactoryFactory needs some parameters so it knows which ObjectFactory factory object to create the object which knows which objects are involved in said projection.

#Comment Re: made: 2010-12-27 20:17:32.859754+00 by: Dan Lyke

My wanting to abandon Apache also has to do with hidden config options and defaults that come along with bloat like that. Something Apache's mod_php is doing totally hoses Mediawiki's attempts to do image rescaling with ImageMagick. That sort of grrrr...

I'm in the process of loading a whole crapload of data into GeoServer, which is pleasant because there's a lot of stuff it's just getting right, but it appears to have the standard Java approach to software structure which means that I've got like 14 clicks and a copy/paste for each of the shape files with identical projections from my source. Sigh.

#Comment Re: made: 2010-12-24 07:37:10.548211+00 by: ebradway

And more than likely, I had Xampp running with Tomcat and Geoserver in the background...

#Comment Re: made: 2010-12-24 07:35:36.295614+00 by: ebradway

I think my tweet a few months ago sums up the state of things:

"Tweetdeck uses more system resources than Oracle Enterprise 10g"

But the fact that I can run both simultaneously on my desktop running Vista (yikes) which I paid $600 for some four years ago demonstrates that code optimization is a waste of human lives.

#Comment Re: made: 2010-12-23 23:05:19.740487+00 by: Dan Lyke

GeoServer will run stand-alone. I'd thought it required Tomcat, which was a dealbreaker (I'd like to get off of Apache, too much unused bloat there nowadays), but if I can run it standalone that's probably the right way to go.

#Comment Re: made: 2010-12-23 22:19:05.593244+00 by: ebradway

I'm a little more of a fan of GeoServer than MapServer. But looking a the docs for each, MapServer at least provides explicit documentation for CGI.

FYI: It would be great if you could make it out to Denver for FOSS4G 2011. I had to step down as conference chair but I'll still be participating heavily.

#Comment Re: made: 2010-12-23 19:59:25.78498+00 by: Dan Lyke

Yeah, I like the Python and C++-ness of Mapnik, but a couple of ... well, not really bugs, but quirks ..., and the lack of documentation on the OGC stuff, and the fact that it looks like it'll have to be really tough to set up the FCGI mode to serve up custom queries is pushing me to suck it up and see about Mapserver.

And apparently there are Perl and Python bindings, so it's not just Java. Okay, I'll go that way.

#Comment Re: made: 2010-12-23 17:42:21.240354+00 by: ebradway

Browsing around Mapnik... I think I see why you started there: Roll your own web mapping server. Afterall, you are the guy who's still running his own blog code...

#Comment Re: made: 2010-12-23 16:10:50.984489+00 by: ebradway

Hehe... Welcome to my level of hell. Each software package handles projections seems to handle projections differently. My recommendation: use proj4 or ogr2ogr to convert your shapefile to epsg:4326 or epsg:google. Yes, software can now do on the fly reprojection. But it's still a PITA.

As for editing the map, I think you just hit the wall with mapnik. I haven't played with it before but a quick read of the site and documentation makes me think someone cobbled together OGCServer so the didn't have to have mapnik render a bazillion tiles just to check out their latest map style. One sign: OGCServer only does WMS which is a raster-oriented, read-only service.

You need to change to a more robust map server, one that supports WFS and WFS-T. WFS is "web feature service". Your vectors from the shapefile will by served up as vectors, not rendered into tiles. WFS-T provides user transactions (i.e., editing).

Oh... wait... I just realized you might mean changing the view parameters. This should be done in OpenLayers (sorry, JavaScript).

#Comment Re: made: 2010-12-23 12:38:33.1126+00 by: Dan Lyke

So the tool I was pointed to was http://prj2epsg.org/search which convinced me that I was working with EPSG:2226 (and I think I suddenly understand something about the NAD83/WGS84 projection/datum thing, but I'm not sure).

In my various mapnik and OGCServer magic I load the shapefile layer with "init=epsg:2226", and that renders in an OpenLayers div such that I can use map.setCenter(new OpenLayers.LonLat(-122.634888,38.233865), 12) and end up looking at Petaluma.

But the OSM layer wants me to do map.setCenter(new OpenLayers.LonLat(-122.634888,38.233865).transform( new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"), 12), so now I have to figure out the magic sauce to get those two layers in the same space when I thought that I'd just put them in the same space...

And then I want to make that OGCServer able to change what it serves based on user input, but I don't see where the WMSFactory gets anything about the CGI request...

#Comment Re: made: 2010-12-23 05:42:28.64258+00 by: ebradway

Depends... And not the adult undergarment... Shapefiles were first "invented" when computers lacked the CPU power for on-the-fly re-projection. So the first anyone did was convert all their data to one projection. And you didn't use the variety of projections and coordinate systems you see today. Typically, you'd work in State Plane for local scale projects, UTM for regional scale and Geographic for world scale. You'd only choose the projection based on the application: what matters more? Direction? Distance? Area? Shape? Like the Heisenberg Principle, you can't know them all at the same time.

The Shapefile spec only requires three files, none of which implicitly provide the projection. Better shapefiles have additional files including metadata in XML format and the projection and coordinate system in a .PRJ file. This page over list's them all..

In the absence of the .PRJ file, you can sometimes determine the projection/coordinate system from the shapefile. Other times you have to scour the source for it. Every once in a while you get to play "guess that coordinate system".

Here are the basic steps:

Load the file into something like OpenJump and look at a point, any point. If the X/Y values are < 360, then you've got Geographic Coordinate System. 99% of the time, it's WGS84. Otherwise, it's gonna be UTM or State Plane. UTM is usually meters and state plane is often in feet. You can sometimes guess this based on relative distances between points.

If it's UTM, then figure out what zone you're in. If it's state plane, then you probably got it from a state source. California, being long north to south has multiple state planes. So you'll have to do a little more sleuthing to find out.

Of course, you could also upload it to GeoCommons and see what it does!