#mapnik log: Monday 23, March 2009

2009 | 03

previous | next
00:10:01 *** D3f0 has quit (Remote closed the connection)
00:10:20 *** milovanderlinden has parted #mapnik ()
00:11:34 *** D3f0 (n=defo@190.176.255.232) has joined #mapnik
01:36:43 <CIA-6> mapnik-utils: dane.springmeyer * r597 /branches/nik2img/ (12 files in 3 dirs): refactor of nik2img.py into a 'mapnik_utils' library and a debug subclass of the Compose object - now using optparse therefore a number of commandline options have changed
01:36:44 <CIA-6> mapnik-utils: dane.springmeyer * r598 /branches/nik2img/nik2img.py: typo
01:36:44 <CIA-6> mapnik-utils: dane.springmeyer * r599 /branches/nik2img/mapnik_utils/mapfile.py: fixed imports for support loading map from python file
01:36:45 <CIA-6> mapnik-utils: dane.springmeyer * r600 /branches/nik2img/mapnik_utils/renderer.py: handle lack of cairo bindings
02:23:05 *** ninja_ (n=pankur@nat/yahoo/x-804251e555d797ba) has joined #mapnik
02:51:04 *** ninja_ has quit ()
03:04:31 *** migurski (n=migurski@dsl081-049-227.sfo1.dsl.speakeasy.net) has joined #mapnik
03:04:48 <migurski> springmeyer it's been a while
04:27:05 <springmeyer> hey migurski
04:27:11 <migurski> hey
04:27:33 <springmeyer> back from the road?
04:28:07 <migurski> yeah for the moment =)
04:28:21 <springmeyer> :)
04:28:30 <migurski> well, not so much travel planned in the near future so that's a relief
04:28:34 <springmeyer> cool, hope you can enjoy it while it lasts
04:29:58 <migurski> trying, yeah
04:29:59 <migurski> how about you
04:31:38 <springmeyer> doing good. been busy with django coding. doing local gis conferences in wash and oregon over the next couple of months
04:31:51 <migurski> oh nice - any chance you'll be down here for Where?
04:31:56 <springmeyer> hopefully the wherecamp guys pin a date down and I'll add that to the list
04:32:18 <springmeyer> I had put in to a where2.0 workshop but didn't make it through the hoop
04:32:33 <springmeyer> so I am thinking about wherecamp
04:33:23 <migurski> what workshop?
04:33:38 <migurski> when we did maps from scratch, they were cool with us having "TA's" =)
04:33:47 <migurski> so Aaron & Tom got freebie passes
04:33:49 <springmeyer> geodjango with jbronn and jlivni
04:33:52 <springmeyer> ah really?
04:33:56 <migurski> maybe a way to get you in if that's what you're looking for
04:34:17 * springmeyer would be interested for sure
04:35:01 <springmeyer> but of course no worries if where is not the same as etech (I would assume it a bit tighter)
04:35:13 <migurski> yeah, shorter time period
04:35:35 <migurski> but I'm viewing it as a favor to O'Reilly, so using whatever strings I can pull to get extra people in
04:36:05 <springmeyer> :) nice, well I'd be flattered to be kept apprised
04:36:16 <migurski> I'll talk to Brady
04:36:38 <springmeyer> I promise I won't utter the word 'boost injecter'
04:37:12 <migurski> engage the boost injectors!
04:37:19 <migurski> so what do they do again? =)
04:37:21 <springmeyer> ar!
04:37:49 <springmeyer> essentially add methods to the existing C++ classes via python
04:39:08 <migurski> oh interesting
04:39:17 <springmeyer> so a simple example was that I'd always wanted to be able to say...
04:39:25 <springmeyer> m = Map(256,256)
04:39:33 <springmeyer> m.scale_denominator()
04:40:11 <springmeyer> instead of importing that separately and figuring out the projection of the map object, and then sticking the map object and its projection into that method
04:40:19 <springmeyer> etc etc...
04:40:20 <migurski> er, yeah =)
04:40:27 <springmeyer> so I added that in the C++ code
04:40:33 <migurski> I've wondered why more of the python bindings aren't written in python
04:40:42 <migurski> there's a lot of potential there effectively closed to py devs
04:40:55 <springmeyer> yes
04:40:59 <springmeyer> ...since it would reduce the lines code I have to write...
04:41:06 <migurski> yeah
04:41:27 <springmeyer> but then I realized that I would break compatibility with anything less than trunk of course
04:41:58 <springmeyer> so I figured the method can just be added in pure python too (for backward compatibility)
04:42:37 *** rcoup has quit ()
04:42:48 <springmeyer> so in that nik2img branch code I've got all sorts of fun stuff now attached to map, layer or datasource objects
04:44:00 <migurski> do you feel like the python API is still a bit of a mess?
04:44:09 <springmeyer> like map.zoom_to_level() map.zoom_to_all_layers() etc etc
04:44:29 <springmeyer> well, I've never felt is messy at all
04:44:30 <migurski> very nice
04:44:48 <migurski> I rely heavily on Modest Maps to do some of that stuff
04:45:12 <springmeyer> just mostly not fully exposing the c++ goodness
04:45:29 <springmeyer> right, I took at look at the modestmaps optparse options first
04:45:46 <springmeyer> then tried to write methods directly onto the map object that matched them...
04:46:07 <springmeyer> as a start anyway
04:46:41 <migurski> oh cool
04:47:00 <migurski> yeah maybe just a big difference in approach or something
04:47:31 <migurski> one of the things I've been thinking of is how to modify the rule / style / symbolizer bindings to get a more dependency-injection-style coding going
04:48:13 <migurski> e.g. pass a list of styles to a rule's constructor
04:48:16 <migurski> that sort of thing
04:48:18 <migurski> silly stuff
04:48:41 <migurski> brb laundry bell just rang
04:48:47 <springmeyer> k
04:52:17 <migurski> back
04:53:00 <springmeyer> okay, interesting. so psuedo code maybe?
04:53:23 <migurski> new Rule( [ style1, style2, style3 ] )
04:53:25 <springmeyer> r = Rule(styles=[])
04:53:29 <migurski> yeah
04:53:30 <springmeyer> k
04:53:32 <migurski> like that
04:53:40 <migurski> it's very XML-like now
04:53:50 <migurski> and if there's one thing I hate about the DOM
04:53:58 <migurski> it's that you have to make things before adding stuff to them
04:54:07 <migurski> instead of making things out of smaller things
04:54:26 <migurski> it's very do-this-then-do-that
04:54:29 <springmeyer> gocha, I agree
04:55:44 <migurski> there are some very odd behaviors I've found as well, things that look like they return references but really return copies
04:55:59 <migurski> or look like they are lists but really just implement the append() method
04:56:19 <migurski> wish I was more meticulous and documented these things as I found them, but I'm usually barging through on my way someplace else =D
04:56:52 <springmeyer> yes
04:57:11 <springmeyer> hanging on that rule construct issue for one sec though..
04:57:16 <springmeyer> right now a Rule constructor accepts like 4 arguments...
04:57:33 <springmeyer> Rule('name','title','min_zoom','max_zoom')
04:58:06 <springmeyer> actually the latter two are scale_denominators I mean
04:59:14 <springmeyer> so my first though would be to write convience functions in pure python that essentally subclassed
04:59:51 <springmeyer> or injected a method on the Rule object of say, r = Rule(); r.add_styles([lists])
04:59:53 <migurski> how would that work?
05:00:23 <springmeyer> class _Rule(Rule,_injector):
05:00:38 <springmeyer>    def add_styles(self,styles_list)
05:00:49 <springmeyer>     ...add them all :)
05:01:47 <springmeyer> but, that said I aggre that being able to add lists of stuff in the contructor could be cleaner/nicer
05:01:52 <migurski> m yeah I see
05:02:07 <springmeyer> ... just not sure how/if that would work from python
05:02:33 <springmeyer> the Coord and Envelope examples at the bottom here are simple examples...
05:02:35 <springmeyer> http://mapnik-utils.googlecode.com/svn/branches/nik2img/mapnik_utils/metaclass_injectors.py
05:02:38 <migurski> not sure like you don't know if it's possible, or not sure which competing version to implement?
05:02:59 <springmeyer> possible
05:03:18 <migurski> there's some scary stuff in that file =)
05:03:28 <springmeyer> I feel like I'm still new to python enough that I don't have a strong sense/preference on style
05:04:03 <springmeyer> ah, not really. just a few useful extra methods and then a bunch of silly dane hacks
05:04:58 <migurski> hehe
05:05:23 <springmeyer> it's this bit of code that makes it work (which I don't pretend to understand): http://dpaste.com/17816/
05:05:23 <migurski> so what does _injector do?
05:05:29 <springmeyer> :)
05:05:35 <migurski> right that =)
05:05:39 <springmeyer> lol
05:06:02 <springmeyer> it just slaps your methods on the mapnik objects in memory
05:06:06 <migurski> huh
05:06:08 <migurski> monkeypatching?
05:06:12 <springmeyer> its wild
05:06:32 <springmeyer> you don't even have to >>> from metaclass_injectors import *
05:06:41 <springmeyer> just >>> import metaclass_injectors
05:06:53 <springmeyer> before or after >>> import mapnik
05:07:14 <springmeyer> ya, monkeypatching at its' best/worst :)
05:08:12 <springmeyer> I guess my only point is that its a good sandbox for figuring out useful methods that could be added in boost python perhaps
05:08:22 <migurski> yeah that makes sense
05:08:50 <migurski> I suppose my preference would be to have the C class fully wrapped
05:09:04 <migurski> but I've not yet worked much with such mixed code
05:09:12 <springmeyer> really?
05:10:03 <springmeyer> one reason I originally took to mapnik python is because it was just another swig interface
05:10:13 <springmeyer> was/was not
05:10:20 <migurski> what's a swig interface?
05:10:52 <springmeyer> swig is what mapserver/gdal use for python and other language bindings
05:11:26 <springmeyer> so you get more or less get all the major function exposed but if feels like C
05:11:44 <springmeyer> perhaps you mean something entirely different by 'wrapped' ?
05:12:55 <migurski> I guess I mean
05:13:04 <migurski> a complete class written in python
05:13:08 <migurski> with the docstrings there, methods, etc.
05:13:14 <springmeyer> ah, ah sorry
05:13:23 <migurski> that contains an internal reference to a C instance
05:13:28 <migurski> upon which methods get called
05:16:38 <springmeyer> cool, sounds more like what jbronn has done with geodjango?
05:17:46 <migurski> I'm not actually familiar with it at all
05:17:59 <migurski> keep hearing good stuff from you & jlivni though =)
05:18:13 <springmeyer> ya, it is good stuff :)
05:19:03 <migurski> can you explain more about this wrapping business?
05:24:12 <springmeyer> gladly, how though?
05:24:45 * springmeyer realizes we must have been meaning to add a list of symbolizers to a Rule earlier?
05:24:47 <springmeyer> http://dpaste.com/17818/
05:27:24 <migurski> okay, so what's happening on line 15 there ?
05:27:35 <migurski> is _Rule a throwaway class defined solely to get that method into Rule?
05:27:39 <springmeyer> yes
05:27:47 <springmeyer> I think it can be named anything
05:29:15 <migurski> okay gotcha
05:30:12 <springmeyer> note 'Extending Wrapped Objects in Python' here..
05:30:19 <springmeyer> http://www.boost.org/doc/libs/1_38_0/libs/python/doc/tutorial/doc/html/python/techniques.html
05:31:16 <springmeyer> "The file __init__.py is what tells Python that the directory sounds/ is actually a Python package. It can be a empty file, but can also perform some magic, that will be shown later."
05:31:18 <springmeyer> he he
05:33:51 <migurski> *magic*
05:37:18 <migurski> boost makes my head hurt
05:38:39 <springmeyer> sorry :)
05:38:58 <springmeyer> looks like it is even easiest with boost than I first understood
05:39:11 <springmeyer> so, same thing without injector magic....
05:39:11 <springmeyer> http://dpaste.com/17823/
05:40:16 <springmeyer> migurski: punch line in boost doc:
05:40:20 <springmeyer> 'Rapid prototyping (you can move the code to C++ if required without changing the interface)'
05:40:26 <migurski> o_O
05:40:51 <springmeyer> so, you're smaart, you write your dream in python. I'll add it to C++ :)
05:41:16 * springmeyer awaits 'syntactic sugar' :)
05:41:36 <migurski> hehehe
05:41:49 <migurski> first need to dig myself out of a project hole
05:42:26 <springmeyer> ya, :)
05:43:47 <migurski> do you have the sense from this chatroom that cascadenik is meeting people's needs btw?
05:44:04 <migurski> I've not been on in some time, but this seems like one of the places where people come to ask about it
05:44:39 <springmeyer> yes, I get the sense that people are either using it an diggin it, or hoping to use it in some way
05:45:38 <springmeyer> when I just was starting to play with this boost stuff at the beginning of the week Berteun was mentioning that he's interested in being able to use cascadenik specifically from python
05:46:31 <migurski> so that would mean no XML roundtrip, yeah?
05:46:32 <springmeyer> http://mapnik.dbsgeo.com/days/2009-03-19
05:46:37 <springmeyer> ya
05:47:27 <migurski> oh it seems like he's looking to modify selectors and stylesheets via python too?
05:47:29 <migurski> interesting
05:47:52 <migurski> transitional encoding formats within transitional encoding formats =)
05:48:05 <springmeyer> ya, and he's also been playing with subclassing mapnik objects I think
05:48:08 <springmeyer> http://dpaste.com/16474/
05:48:09 <springmeyer> :)
05:48:34 <springmeyer> he's in the netherlands I think so maybe he'll see this chat in the morning
05:48:44 <migurski> hehe
05:49:31 <migurski> this usage here, is a lot of what I'm talking about
05:49:40 <migurski> so it seems like it's all already supported
05:50:53 <springmeyer> right, I think he's written some wrappers
05:51:48 <migurski> oh I understand
05:52:07 * migurski notices "pymapnik"
05:52:34 <migurski> "import *" is such a drag for reading code
05:52:39 <springmeyer> exactly :)
05:53:03 <migurski> will need to bother him about this
05:59:43 <springmeyer> huh. possible? what was I talking about?
06:00:05 <springmeyer> obviously hacky since its not subclassing or overriding the __init__
06:00:11 <springmeyer> but it works fine: http://dpaste.com/17827/
06:02:19 <springmeyer> okay, glad you are going to bother Berteun :)
06:02:33 <springmeyer> I've gotta pack for a ski trip early am
06:03:20 <springmeyer> heading to the methow valley, should be a good kick in the lungs since it'll be skate skiing
06:05:25 <springmeyer> thanks for the ping migurski
06:05:47 <migurski> good talking to you =)
06:05:52 <migurski> enjoy skiing!
06:05:55 <migurski> jealous
06:10:10 <springmeyer> thanks a ton
07:34:12 *** vosson (n=chatzill@193.91.181.126) has joined #mapnik
07:35:33 *** migurski has quit ()
07:54:55 <Berteun> Good morning. :)
08:05:47 *** D3f0 has quit (Remote closed the connection)
09:46:42 *** rcoup (n=rcoup@ip-118-90-56-192.xdsl.xnet.co.nz) has joined #mapnik
10:23:57 *** rcoup has quit ()
10:56:48 *** scruggs has quit (brown.freenode.net irc.freenode.net)
10:57:29 *** scruggs (n=chris@75-121-84-235.dyn.centurytel.net) has joined #mapnik
11:00:33 *** Davedan has parted #mapnik ()
12:35:12 *** synax (n=synax@24.222.57.182) has joined #mapnik
12:37:41 <synax> is there any decent documentation for Mapnik available anywhere?
12:38:00 <synax> The epydocs included with the package are...useless
12:50:45 *** Scelestis (n=Scelesti@pool-173-79-14-202.washdc.fios.verizon.net) has joined #mapnik
12:55:50 <synax> *ugh* I don't even know where to start...
12:56:35 <synax> I'm trying to generate a custom tile layer from an ESRI shapefile for use with Google Maps
12:57:29 <synax> Using the basic world map demo, I've been able to output the shapes as a raster, but I still have no idea how Mapnik works (what's a Rule? Style? *Symbolizer?)
13:29:14 <synax> springmeyer: are you around?
13:32:23 <Scelestis> I am having trouble setting a bounding box on the tilecache seed script,  Whenever I try to use one, the script just sits there, it doesn't seem like it working at all, and I've left it for a fair amount of time., I am using a merc projection and have tried with the normal lat/long and a merc conversion for them, but I always get the same "frozen" seeding
13:53:52 <Berteun> synax: What are you using, a Python script, a XML file?
13:54:04 <synax> Python script
13:54:33 <Berteun> And you just try to follow the demo?
13:54:47 <synax> I've followed the demo and had it produce output
13:56:20 <Berteun> Okay, in short: You have a bunch of layers, those are, well, layers, with each some aspect of your map, I assume you get that.
13:56:34 <Berteun> Like first you have the land layer, then for example rivers, then roads, et cetera.
13:56:36 <synax> I'd like to take the shapes defined in my shapefile(s) and produce something to use as a GTileLayerOverlay
13:57:20 <Berteun> That's for Google maps?
13:57:23 <synax> yes
13:57:26 <Berteun> I don't know anything about that…
13:57:33 <Berteun> I assume you want to generate tiles too then?
13:57:38 <synax> well just assume I want to generate tiles
13:58:36 <Berteun> Did you have a look at OpenStreetMap?
13:58:45 <Berteun> Not to tell you not to use OSM.
13:58:54 <Berteun> But they use Mapnik too to generate tiles.
13:58:57 <Berteun> http://svn.openstreetmap.org/applications/rendering/mapnik/generate_tiles.py
13:59:07 <Berteun> Uh, not to tell you not to use Google.
13:59:27 <Berteun> But anyway, what I wanted to say, you first define your layers, then you need to instruct mapnik how it should render the content of each layer.
13:59:31 <Berteun> For that you need a style.
13:59:53 <synax> yes, that much I gathered
13:59:55 <Berteun> Like a 'water style'
14:00:02 <Berteun> And the water style consists of rules.
14:00:11 <synax> and Rules are used as a wrapper to Filter?
14:00:23 <Berteun> Yeah, and they have symbolizers too.
14:00:40 <synax> Symbolizers are abstract "elements" on a map?
14:00:42 <Berteun> The filters select the appropriate elements, and define the scale for which the rule is valid.
14:01:07 <Berteun> Yeah, you would for example use a linesymbolizer to draw roads.
14:01:12 <Berteun> And railroads.
14:01:41 <synax> how do Filters work though?
14:01:43 <Berteun> And shops for example could be done by point symbolizers.
14:01:57 <Berteun> They depend a bit on your data source.
14:02:11 <Berteun> But if you have shapefiles, with certain columns.
14:02:21 <Berteun> You can use the columnnames to filter certain elements.
14:02:39 <synax> Interesting
14:03:02 <Berteun> So, if you look at:
14:03:03 <Berteun> provpoly_rule_qc.filter = Filter("[NOM_FR] = 'Québec'")
14:03:35 <Berteun> This wil only select Québec... not so exciting perhaps.
14:03:49 <synax> Looks to me like it's only applying said rule to any elements in column NOM_FR that belongs to Québec
14:04:17 <Berteun> But you could imagine that it would be something like Filter("[Shop] = 'Supermarket'")
14:04:49 <synax> Berteun: can you give me any references for valid SRS options? What is SRS?
14:05:15 <Berteun> A srs is the projection you want to use.
14:05:44 <Berteun> Spatial Reference System it means...
14:05:51 <Berteun> It basically determines the shape of your map.
14:06:18 <Berteun> There are some examples about that.
14:07:48 <Berteun> Can't find it...
14:08:09 <synax> no worries, at least I know what the acronym stands for so I should be able to dig up some more information on it
14:08:16 <Berteun> But I guess you have seen pictures like these:
14:08:17 <Berteun> http://en.wikipedia.org/wiki/Mollweide_projection
14:08:39 <Berteun> By changing the srs parameter, you can instruct mapnik to project the world (or part of it) using this projection.
14:08:43 <Berteun> or any other projection...
14:09:05 <Scelestis> Can bounding boxes be set in the SRS ?
14:09:20 <Berteun> I don't think so.
14:09:33 <Berteun> Some srs's have a limited area in which they are valid though.
14:10:00 <Berteun> You'd use the zoom_to_box() method to fix the map on a certain area.
14:10:10 <Berteun> that's also in the rundemo.py
14:11:22 <Berteun> If you're looking for specific projections, you can always look at spatialreference.org, for example: http://spatialreference.org/ref/esri/54009/
14:12:22 <synax> I was more or less looking for a list of all the valid SRS options
14:13:11 <Berteun> It's more or less unlimited... :)
14:13:43 <Berteun> In practice every country has its own spatial reference system (or even several) that minimize distortion in that country.
14:13:57 <Berteun> Because if you project a round earth on a flat surface, you'll always get distortion.
14:14:31 <Berteun> So the Dutch and the Germans and the Swiss and the French and the British: they all have their own systems that work best for their own country.
14:14:56 <Berteun> Like minimal distortion of distances and minimal distortion of angles.
14:15:06 <Berteun> Worldwide however, that's not possible.
14:15:26 <Berteun> For example, on google maps, if you zoom out completely, you'll see greenland looks about as large as Africa.
14:15:50 <Berteun> Whereas in reality Africa is 14 times as large. But that's a consequence of wanting to plot the whole world.
14:17:00 <synax> yeah, I understand the projections...
14:17:29 <Berteun> So, you can look at spatialreference, but in the end the srs option can be 'any valid proj-string', where proj is a projection library.
14:17:30 <synax> but what's the syntax/+whatever options for them?
14:17:37 <synax> yes
14:17:44 <synax> what are the valid proj.4 strings?
14:17:50 <Berteun> That can be found here: http://trac.osgeo.org/proj/
14:18:16 <Berteun> I just look them up at spatialreference if I need them though. :)
14:18:42 <synax> cool, thanks
14:19:14 <synax> damn that site is slow (spatialreference.org)
14:20:42 <Berteun> Did you find the mapnik wiki BTW?
14:20:59 <Berteun> Esp. http://trac.mapnik.org/wiki/GettingStarted and http://trac.mapnik.org/wiki/XMLGettingStarted might be of use.
14:23:44 <synax> yeah, I did read the GettingStarted guide
14:24:30 <synax> I'm a little disappointed at the lack of API documentation. Having to look in the rundemo.py source for an explanation of what parameters most of the methods take is a bit odd
14:27:01 <Berteun> True, but writing docs isn't the most exciting. :)
14:27:13 <Berteun> Your best bet is to find examples...
14:27:19 <Berteun> That's how I worked too.
14:27:28 <Berteun> Openstreetmap uses mapnik extensively.
14:28:53 <Scelestis> Anyone with knowledge of tilecache on?  Seeding with a bounding box is saddening
14:29:57 <Berteun> Nope.
14:31:17 <Scelestis> I am wondering if you just try and set a bounding box with the whole OSM database loaded it may just take a very long time
14:52:34 <Scelestis> dukeku: You mention to me earlier about querying a specific range of geom data to get a localized area, using St_within(ST_SetSRID(ST_GeomFromText('LINESTRING(lon lat, lon lat, lon lat, lon lat)'), 4326), the_geom),   I am not sure where to get the geom or lat/lon areas in question, when I query the tab les in question (select * from planet_osm_point where place = 'city';), I end up with a colum label way_geomtry (sounds rig
14:55:40 <Scelestis> **the coluumn is labeled Way, and it's set as the type geometry
15:06:15 *** vosson has quit (Read error: 110 (Connection timed out))
15:19:29 <dukeku> ah :)
15:29:29 <Scelestis> Any idea what that geometry data is?
15:51:56 *** migurski (n=migurski@dsl081-049-227.sfo1.dsl.speakeasy.net) has joined #mapnik
15:52:00 *** migurski has quit (Client Quit)
16:50:51 *** D3f0 (n=defo@190.176.255.232) has joined #mapnik
17:07:58 *** ccccc (n=sd@aber.tvpn.co.uk) has joined #mapnik
17:47:09 *** springmeyer has quit ()
17:58:39 *** aba_ (i=sam@libya.turmzimmer.net) has joined #mapnik
18:11:44 *** aba has quit (Read error: 101 (Network is unreachable))
18:14:22 *** D3f0 has quit (Read error: 60 (Operation timed out))
19:23:22 *** synax has quit ()
19:44:55 *** rcoup (n=rcoup@ip-118-90-116-120.xdsl.xnet.co.nz) has joined #mapnik
19:51:54 <Scelestis> I'm still not getting that query to function to only include (ultimatly exclude) an area from a layer of text
19:52:28 <Scelestis> select * from planet_osm_point WHERE St_within(ST_SetSRID(ST_GeomFromText('LINESTRING(-77.2 38.8, -76.99 39)'), 4326), way);  takes a whopping 18ms to return nothing from that query
19:53:42 <Scelestis> wanting to select only things that fall in that bounding box, planet_osm_point has a lot of text labels for cities/areas/etc, and I want to only get a certain area returned
19:54:04 <Scelestis> way is the column with
19:54:08 <Scelestis> geometry as the type
20:38:24 <Scelestis> ok, so using St_asText(geom) returns a textual representation of that colum, since the database is all single points, all the geometry st_astext returns 'POINT( X, Y)'
20:39:45 *** vosson (n=chatzill@126.80-202-247.nextgentel.com) has joined #mapnik
20:43:14 <Scelestis> so if I use St_geomFromText to make a polygonal bounding, I can use St_within on said bounding box to return all rows meeting that criteria??
20:47:30 <rcoup> Scelestis: you need to use the index :) WHERE way && ST_SetSRID(ST_GeomFromText('LINESTRING(-77.2 38.8, -76.99 39)'), 4326)
20:52:57 <Scelestis> this is actually what I have so far
20:53:14 <Scelestis> WHERE St_within(ST_SetSRID(ST_GeomFromText('POLYGON(BoundingBox)'), 4326), the_geom) = '1';
20:53:34 <Scelestis> I am not sure I understand yours rcoup
20:53:39 <rcoup> Scelestis: sure, but that won't use the index.
20:53:42 <rcoup> ie. slow
20:54:01 <Scelestis> I am new to SQL in general, I am not sure what using the index is/means
20:54:25 <rcoup> well, ST_Within will go through every record in the table, one at a time, and compare the geometries
20:55:10 <rcoup> && will look at the index (ie. optimised summary of the geometries, an r-tree if you care) so it only needs to look at a handful of records to get the right answer
20:56:04 <rcoup> http://postgis.refractions.net/documentation/manual-1.3/ch04.html#id2743922
20:56:42 <rcoup> although "As of PostGIS 1.3.0, most of the Geometry Relationship Functions, with the notable exceptions of ST_Disjoint and ST_Relate, include implicit bounding box overlap operators."
20:56:46 <rcoup> so maybe i'm talking crap :)
21:00:43 <Scelestis> hmm, ok I'll keep this in mind, speeding up rendering, or keeping it from being slow, is always good
21:03:34 <Scelestis> so, I assume if I did an St_asText query, and got the POINT( X, Y) in merc proj,  NOT normal lat/lon, I should be using merc bounding boxes ?
21:04:18 <rcoup> umm, you should do the comparison in whatever projection the data is stored in...
21:04:30 <Scelestis> right, it seems like it's stored in Merc
21:04:34 <rcoup> ie. projecting 1 point rather than every record in the table
21:21:55 *** vosson has quit (Read error: 110 (Connection timed out))
21:26:31 <Scelestis> can I do a line string to represent a bounding box? one corner to the other? I am using POLYGON and getting geometry or "non-closed ring" errors
21:39:25 <Scelestis> right, fixed my polygon stupidity, now the SQL syntax "seems" ok, but I am getting an 18ms query with 0 results on: SELECT * FROM planet_osm_point WHERE St_within(way, ST_SetSRID(ST_GeomFromText('POLYGON((308952.8151939956 4296881.663926308, 308952.8151939956 4318660.307405118, 327675.1275164049 4296881.663926308, 327675.1275164049 4318660.307405118, 308952.8151939956 4296881.663926308))'), 4326)) = '1';
21:41:55 <Scelestis> Can I use St_withIn as such:   St_withIn(st_geomfromtext('point(X Y)'), St_geomfromtext('polygon((x1 y1, x1 y2, x2 y1, x2 y2, x1 y1))'))  ??
21:42:24 <Scelestis> mainly, using st_within to compare a point in geom to a polygon in geom ?
21:42:43 <rcoup> Scelestis: "ST_Within(geometry A, geometry B)    Returns 1 (TRUE) if Geometry A is "spatially within" Geometry B. A has to be completely inside B."
21:42:51 <rcoup> B) is B )
21:43:06 <rcoup> so you probably want point, polygon right?
21:43:53 <Scelestis> right    way  is the geom column that is a geom value for point( x, y)
21:44:55 <rcoup> so what does "SELECT st_astext(way) FROM planet_osm_point LIMIT 1;" return?
21:46:04 <Scelestis> "POINT(-12686160.4399505 6608039.26418688)"
21:47:05 <rcoup> ah. what does dropping the "= '1'" thing do to your query? ST_Within returns a boolean so it doesn't need a comparison.
21:48:05 <Scelestis> essentially the same thing, 0ms query, no results
21:48:24 <Scelestis> 20ms**
21:49:13 <rcoup> Scelestis: are there actually points inside your polygon? :)
21:49:19 <rcoup> query looks ok
21:49:58 <Scelestis> good question, if I use my query with = '0' that should answer that yes?
21:50:15 <rcoup> well: NOT ST_Within()
21:50:38 <rcoup> apart from using the wrong srid (4326 is lat/long coordinates), but as long as you're doing it consistently it shouldn't matter.
21:50:40 <Scelestis> hmm, yeah that gave me error differeny SRIDS
21:50:51 <rcoup> hmm
21:51:14 <Scelestis> honestly I am hoping the bounding box I am putting is is the merc BB for the USA
21:51:15 <rcoup> so what does select SRID(way) FROm planet_osm_point LIMIT 1; return
21:52:16 <Scelestis> 900913
21:52:44 <rcoup> aha
21:52:46 <rcoup> ok
21:53:05 <rcoup> try SELECT * FROM planet_osm_point WHERE St_within(way, ST_SetSRID(ST_GeomFromText('POLYGON((308952.8151939956 4296881.663926308, 308952.8151939956 4318660.307405118, 327675.1275164049 4296881.663926308, 327675.1275164049 4318660.307405118, 308952.8151939956 4296881.663926308))'), 900913))
21:54:04 <Scelestis> no results
21:54:49 <Scelestis> is there a tool I can use to make sure my bounding box isn't retarded?
21:55:04 <Scelestis> hmmm
21:55:22 <Scelestis> I used the ssrid of 900913 and did = '0'; and the query is running
21:55:31 <rcoup> ok
21:55:41 <rcoup> so probably your BB is wrong now :)
21:55:49 <rcoup> how did you build it?
21:56:23 <Scelestis> guessing lat/lon of the USA, plugging that into a UTM calc
21:57:45 <Scelestis> I assumed roughly -77.2 38.8, -76.99 39 as the bounding box in lon/lat for the US, wasn't trying to be super precise, then used http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html to get a merc proj for it
21:58:42 <rcoup> Scelestis: so you could do SELECT ST_Transform(ST_Envelope('SRID=4326;MULTIPOINT(lon1 lat1, lon2 lat2)'), 900913);
21:59:08 <rcoup> utm isn't the same as global mercator
21:59:29 <rcoup> ah, st_AsText() around the outside of that :)
22:01:07 <Scelestis> so I am assuming that's the first problem, not havign global merc
22:15:11 <Scelestis> well it's time for dinner, thanks a lot rcoup, I learned a great deal about all of this
22:26:34 <rcoup> Scelestis: :)
22:35:56 *** D3f0 (n=defo@190.176.229.135) has joined #mapnik