Re: finding out what SQL Django generated

2009-04-15 Thread Justin Bronn
> If it's docs links you want :) : > > http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-ra... This isn't in the docs, but it also works: >>> qs = Foo.objects.all() >>> qs.query.as_sql() It returns a two-element tuple comprised of the generated SQL and parameters,

Re: Geodjango GPolygon

2009-02-16 Thread Justin Bronn
> Im afraid that it does not change anything by leaving out the fromstr > and wkt. > It is a really weird problem reversing the lat and lng like that... It's probably because your GEOS polygon has the order wrong to begin with. All spatial databases use (x, y) ordering -- in other words (lon,

Re: How to set the right PostGIS path to PostgreSQL 'share' directory

2009-02-13 Thread Justin Bronn
> flex??? Yes, `flex` is a prerequisite package to build PostGIS. If using ubuntu/debian then do `apt-get install flex`; redhat/centos then `yum install flex`. > You may have a bit more luck consulting a forum specifically for > PostGIS; people who are familiar with its workings will likely

Re: (GeoDjango.. again) Silly question - grab single lat and long value from a MultiPointField?

2009-02-13 Thread Justin Bronn
> But with a MultiPointField doing the same gives me nada.  Where am I > going wroing? A MultiPoint geometry is a collection, so you would index it like an array to get the Point geometry. In other words, treat like a list of Points. {{ multipoint.0.x }}, {{ multipoint.0.y }} -Justin

Re: GeoDjango - Center of a Polygon

2009-02-13 Thread Justin Bronn
On Feb 13, 6:25 am, Alfonso wrote: > How do I grab the center x and y co-ordinates of a polygon and display > that in a template? {{ poly.centroid.x }}, {{ poly.centroid.y }} Note that the centroid point is not guaranteed to be on the surface of the polygon -- if that

Re: Postgresql v MySQL

2009-02-08 Thread Justin Bronn
On Feb 7, 8:06 am, Tim Chase wrote: > PostgreSQL has built-in GIS data-types and functions, which I > believe are required for theGeoDjangofunctionality (or Oracle). >   PG also allows flexible creation of new data-types and > functions/operators as shown by the

Re: openlayers TemplateSyntaxError

2009-02-07 Thread Justin Bronn
You need to add 'django.contrib.gis' to your INSTALLED_APPS. This is in the install docs: http://geodjango.org/docs/install.html#add-django-contrib-gis-to-installed-apps -Justin On Feb 3, 11:39 pm, Waruna de Silva wrote: > Hi , > > I'm newbie to django as well

Re: working with shp files and geodjango

2008-12-30 Thread Justin Bronn
The numbers have different values because the shapefiles have data in different coordinate systems. It looks like the data for that shapefile is actually for the 3435 SRID: http://spatialreference.org/ref/epsg/3435/ (3084 a NAD83 projection for all of Texas!). Unfortunately, most shapefiles

Re: Multithreading issu with GDAL transform

2008-12-10 Thread Justin Bronn
> in our views. It seems that this call ist not thread safe. Because it is > several weeks (or month) ago that we had this problem, I just wonted to > ask, if it is known. No, it is not thread safe. This is because both the GEOS and GDAL libraries are not thread safe. While those development

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-12-03 Thread Justin Bronn
> "The same problem [segfault] could afflict any python package that > uses Ctypes on 64-bit systems without explicitly marking argument and > return types. " > > Looking back through the modwsgi thread and this one, everyone's on > 64bit, except the CentOS guy who said it worked ok on 32bit but

Re: GeoDjango question about US zipcode lookup and spatial query

2008-12-01 Thread Justin Bronn
> Thanks Justin, I was using MySQL and it looks like I do need Postgres to get > the best gis support. > Do people normally switch their DB backend entirely or do they start a new > project for geo stuff and connect the main site to this as a separate > backend? I can see the pros and cons of

Re: GeoDjango question about US zipcode lookup and spatial query

2008-11-29 Thread Justin Bronn
> I do have a few basic questions > - on slide 37, there's a Zipcode model, how does one populate this model? > Are we using fe_2007_us_zcta500.shp? If so, is there a program which > converts the zipcode shape from the shape file? Yes, you use that shapefile. The script that loads the data is

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-11-25 Thread Justin Bronn
> I reran my tests with the latest version of Apache on my 8.10 test > machine.  I am no longer getting the Segfaults with either worker or > prefork.  I am now getting an Invalid SRS type "wkt" error (that I > assume you are now running into). Yup that's the error I got:

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-11-25 Thread Justin Bronn
> Based on comments in a separate thread, GeoDango may have issues with > multithreaded configuration. Which Apache MPM was being used for each > Apache version, prefork or worker? The worker MPM uses threads and so > that could be the culprit. Yes -- the libraries GeoDjango uses, GEOS and GDAL,

Re: add a to_kml routine ti contrib.gis.gdal

2008-11-11 Thread Justin Bronn
Guillaume, I had forgot that GDAL now can export to KML, I appreciate you taking the initiative here. I think I've identified what's causing you grief -- ctypes prototypes must _strictly_ follow what is defined in the C API. In `ogr_api.h` the definition is: char CPL_DLL *OGR_G_ExportToKML(

Re: GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Justin Bronn
> Also, it's on CentOS 5.2 > Just want to be complete. > Turn off SELinux. I'm almost positive that's your problem. -Justin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Justin Bronn
> However, if I access the application over http, the server hangs at > exactly that spot.  No error logged. > If I comment out the line, everything runs fine. You're going to have to provide more details on exactly what "http" means here. How are you deploying, e.g., mod_wsgi, mod_python,

Re: geodjango: installation comments.

2008-10-23 Thread Justin Bronn
On Oct 18, 2:21 pm, "Jorge Vargas" <[EMAIL PROTECTED]> wrote: > I did found some inconsistencies on the docs I'll like to point out: > 1- the different installation docs use a methodology with little > changes, probably due to being written by different people. it will be > nice to unify them

Re: Mercurial or Git

2008-10-23 Thread Justin Bronn
On Oct 22, 2:54 pm, Rit Lim <[EMAIL PROTECTED]> wrote: > which one is the Django community moving toward to, mercurial or git? I would say the most popular among Django core developers is git. I use mercurial (with hgsvn), and Gary Wilson uses bazaar. Personally, I chose mercurial because I

Re: GeoDjango / GIS Garbage Collection Error

2008-09-25 Thread Justin Bronn
On Sep 23, 5:09 pm, Andrew Fong <[EMAIL PROTECTED]> wrote: > When a Django process terminates, I get the following error message: > > Exception exceptions.TypeError: "'NoneType' object is not callable" > in  ignored > Thanks for giving detailed reproduction steps; I've confirmed this behavior.

Re: Django 1.0 GIS Module (aka GeoDjango) and MySQL

2008-09-10 Thread Justin Bronn
> Does anyone know if the layermapping utility of the django gis module > supports a MySQL database backend, I keep getting error messages about > not being able to import GeometryColumns from > django.contrib.gis.models? No, it does not support MySQL. More specifically, MySQL does not conform

Re: geodjango join problem

2008-09-02 Thread Justin Bronn
> class Location(models.Model): >   geo_loc         = models.PointField() > > The thing that strikes me as strange is that the geomanager doesn't > show up at all in the traceback...  not sure why I can't do a join on > geo_loc ?! > > Thanks for your help. You need to put `objects =

Re: Newbie Question - Regex Field to deal with Feet/Inches

2008-08-28 Thread Justin Bronn
bkev, GeoDjango has measurement objects: http://geodjango.org/docs/measure.html It does conversions (supports feet, inches, yards, miles, among others) and lists of distance instances are sortable. It's loosely coupled, so regular Django projects may use it without installing any of the

Re: dynamic creation of model with geodjango ?

2008-08-19 Thread Justin Bronn
> Yes, actually I didn't hope anything else. > I'll try to catch some geodjango guys up in Cape Town FOSS4G to have a > chat about this. It can be something I can find funding for, as it is > extremely critical in deploying Spatial data infrastructures. > Guillaume, Howdy -- nice hearing from

Re: GeoDjangoFriendly?

2008-05-04 Thread Justin Bronn
> Anyone have experience/opinions on hosting GeoDjango with PostGIS on > WebFaction or Slicehost (or any other of the DjangoFriendly hosts)? > I'm wondering if WebFaction shared account allows you enough freedom > to install all the geodjango dependencies... While I don't personally use

Re: Can I use Django to display data form a legacy database?

2008-05-04 Thread Justin Bronn
> Thanks.  To be sure, when I do the python manage.py syncdb, that > doesn't alter my existing database does it?  What is syncdb doing in > this case? It is typically worth the effort to search the docs: http://www.djangoproject.com/documentation/django-admin/#syncdb Particularly, read the

Re: GeoDjango: distance between PointFields problem

2008-04-23 Thread Justin Bronn
> > (1) What geographic fields are in your model, what type are they > > (e.g., PointField, etc.), and their SRID. > > A plain PointField, e.g.: ``location = PointField()``. I > believeGeoDjangodefaults to WGS84 for the SRID. > > > (2) The geometry type of the parameter you're passing to

Re: GeoDjango: distance between PointFields problem

2008-04-22 Thread Justin Bronn
> I'm calculating the distance between two plain PointFields in the GIS > branch using the distance GeoQuerySet method [1] and I'm coming up > with some confusing results. > I require more information before I can answer your inquiry: (1) What geographic fields are in your model, what type are

Re: Response JSON Quoting

2008-04-16 Thread Justin Bronn
> After installing mod_python 3.3.1, reinstalling Django 0.96 (from svn > trunk), and reinstalling psycopg2 2.0.5.1, the quoting is all screwed > up and my Javascript no longer functions. Are you sure pulled 0.96 from the svn? Auto-escaping has been in trunk for 5 months now (r6671). -Justin

Re: Dynamically limiting choices in admin.

2008-04-15 Thread Justin Bronn
Rodrigo, I've found this to be a common use-case among many projects of mine. The admin becomes completely unusable if you have hundreds of thousands of possibilities for ForeignKey and/or ManyToMany relations. I've created a `ModelAdmin` (newforms-admin) subclass called `LimitedRelatedAdmin`

Re: GeoDjango: Completely Overwhelmed

2008-04-15 Thread Justin Bronn
> This is precisely the kind of pointer I was looking for. I've read the > documentation about a PointField, but wasn't sure what the application > was or how it works with the rest. Here's a silly question: I can > mixin theseGeoDjangofield types with the base field types from > Django, right?

Re: problem installing GeoDjango (ERROR: Testing closing Polygon objects)

2008-04-15 Thread Justin Bronn
Tyler, > Any thoughts on what is causing the test to fail? This is because of a bug I reported in the GDAL library (versions 1.4.1 and below): http://trac.osgeo.org/gdal/ticket/1673 Fortunately, the bug is isolated to a single feature that is not used by the GeoDjango internals: the

Re: Cleaning up Word's mess in text areas using tiny_mce

2008-04-09 Thread Justin Bronn
> Is there a way to strip out all the Word-generated crap (font > tags, colors, etc.) while maintaining basic html tags like p, br, ul, > etc? > I've had some success adapting Jeff Atwood's Word HTML regular expressions to Python in order to remove the MS HTML cruft: def sanitize(html): #

Re: geo django and mysql

2008-03-31 Thread Justin Bronn
Greg, Please read the GeoDjango Database API documentation: http://code.djangoproject.com/wiki/GeoDjangoDatabaseAPI#CreatingandSavingGeographicModels In short, you may use WKT strings directly, e.g., `m = MyModel(mpoly='MULTIPOLYGON(((..)))')`. The API is the same whether you're using PostGIS

Re: GeoDjango: distance calculation

2008-03-04 Thread Justin Bronn
> For some of our calculations, it is much too slow to use distance_spheroid - > the slight loss in accuracy is worth the enormous gain in speed. I did some performance tests and confirmed your findings. I've created a ticket that includes a patch that changes the default geodetic distance

Re: Informix

2008-02-21 Thread Justin Bronn
Mateusz, Even though we corresponded on IRC, I'd like to respond for the benefit of the community. First, there is no dedicated GeoDjango list (yet) -- but we do have a dedicated channel on freenode (#geodjango). There are no Django database backends for Informix and DB2. GeoDjango requires

Re: GeoDjango: distance calculation

2008-01-18 Thread Justin Bronn
> We are starting to usegeodjango(revision 7003) and are having > problems using the api to calculate distance. > > class Airport(models.Model): > icao = models.CharField('ICAO', max_length=4) > location = models.PointField() > First, a reminder to add the `objects.GeoManager()` to your

Re: gis: MySql Persistence Problem

2008-01-08 Thread Justin Bronn
Ben, > Can anyone help as to why I can't load my points? Is it a MySql problem? > No, it is not a MySQL problem. This didn't work because you forgot to set the model manager to use the `GeoManager`, i.e., you didn't add `objects = models.GeoManager()` to both your UserProfile and Lcoation

Re: Is GeoDjango stable.

2008-01-02 Thread Justin Bronn
Generally, GeoDjango is as stable as trunk (the latest merge was today -- we're in sync up to r6990). This topic was discussed in-depth in a previous thread: http://groups.google.com/group/django-users/browse_thread/thread/f6d73b6ec1be2f03 > I took a look at the revisions and it seems to be

Re: GeoDjango: Invalid spatial reference pointer returned from "OGR_L_GetSpatialRef"

2007-12-12 Thread Justin Bronn
> Should the example still work with the latest svn revision of > GeoDjango? The IPython session is pasted below. Yes, it should work. You found a bug -- I just fixed it in r6916. There have been some significant changes to GeoDjango since FOSS4G (e.g., GEOS & GDAL refactors, distance queries,

Re: GeoDjango Distances

2007-11-22 Thread Justin Bronn
Dan, You raised some excellent questions, thanks for sharing. > 1 - Is there anyway in Geodjango to calculate distances between two > points? GEOSGeometry objects may be used to calculate the distance between two points. For example: >>> from django.contrib.gis.geos import Point >>> p1 =

Re: GeoDjango: Can't find libraries and geos errors

2007-11-17 Thread Justin Bronn
> On OS X, using MacPorts, ctypes doesn't look in /opt/local/lib unless > you set LD_LIBRARY_PATH. On Ubuntu Feisty, the gdal package uses a > weird naming convention and isn't found. Is it possible to specify > these library locations in settings.py or somewhere? There are no explicit settings

Re: Using GeoDjango features with current trunk?

2007-11-05 Thread Justin Bronn
As Karen noted, I last merged on 10/26 to r6613 -- thus, the latest GeoDjango is more up-to-date than your latest checkout of trunk (r5988). > If the trunk and GeoDjango AREN'T currently compatible, would it be > possible for us to add geometry columns AFTER a syncdb creates the > "standard"

Re: RESTful Geodjango

2007-11-05 Thread Justin Bronn
> (2) The gis branch should really use a better name than "NoField" here. > Not a lot of code calls get_internal_type() -- the main critical piece > being db_type(). In all the cases where django.contrib.gis overrides > get_internal_type(), they are also returning None from db_type(). So the >

Re: geodjango and MySQL

2007-10-26 Thread Justin Bronn
Greg, A preliminary MySQL spatial backend was added last week in r6527. The documentation for the MySQL database API may be found at: http://code.djangoproject.com/wiki/GeoDjangoDatabaseAPI#MySQL You should be aware of MySQL's spatial limitations: (1) all spatial queries are restricted to the

Re: RESTful Geodjango

2007-10-20 Thread Justin Bronn
I quickly glanced at the django-rest-interface code and I don't see any reason why it shouldn't work. There are no plans to combine yet, though it would be nice to have GeoJSON serializers for the GEOS/OGR geometry objects. The best way to confirm compatibility is experiment yourself! -Justin

Re: DB API - filter/exclude bug ?

2007-10-07 Thread Justin Bronn
> So my object ' de la tourelles>' can't appear in both queryset, right? Not necessarily. For example, if you had a Place ("Paris"), it may be associated with multiple users because of the ManyToManyField ("M2M"). In this case let's say Bob and Jane both have a M2M entries to Paris. When you

Re: ip to location

2007-07-18 Thread Justin Bronn
Francesco, MaxMind(R) produces commercial and free IP geolocation datasets. As a proof of concept I created GeoDjango-enabled models and import scripts for their CSV files: http://www.djangosnippets.org/snippets/327/ http://www.djangosnippets.org/snippets/328/ To create this code I had to

Re: GenericRelation support in GeoDjango

2007-06-06 Thread Justin Bronn
> I am wondering if it is known what needs to be done to bring the > contrib.contenttypes functionality up to date in the gis branch. > Specifically I'm looking for the generic relation support. I hadn't used or tried out generic relations until today, it's good stuff. The GIS branch is

Re: problems using django on lighttpd with fastcig

2007-06-05 Thread Justin Bronn
> It is in the fastcgi Django docs > (http://www.djangoproject.com/documentation/fastcgi/), although I've > heard similar things said about PHP+Fastcgi. When I did my setup ~8 months ago, I discovered the module load order from the Lighttpd docs about the 'server.modules()' directive:

Re: problems using django on lighttpd with fastcig

2007-06-01 Thread Justin Bronn
I've had great success with lighty & django, and actually prefer using it over apache. > server.modules = ( > ... > "mod_fastcgi", > "mod_accesslog" > ) I believe this might be your problem. When using lighttpd the ordering of the server modules is important and 'mod_fastcgi'

Re: installing django on vista?

2007-05-26 Thread Justin Bronn
>1) put c:\python25\bin on your path. Python on Windows actually installs the executables in "C:\Python25" -- that should be in your path instead. > 3) Add a django.pth file to c:\python25\site-packages. In that file, > include the following line: > c:\django\ Likewise, the site-packages

Re: GeoDjango Admin interface - Invalid HEX given!

2007-05-24 Thread Justin Bronn
> I'm just moving an application that we were writing over to the GeoDjango > branch Welcome! > However I am unable to add a new one using the admin ... > when attempting to create a new instance. You found a bug in WKTField -- good catch. > Any help would be much appreciated. Thanks It