> 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,
> 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,
> 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
> 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
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
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
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
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
> 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
> "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
> 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
> 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
> 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:
> 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,
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(
> 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
> 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,
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
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
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.
> 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
> 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 =
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
> 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
> 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
> 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
> > (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
> 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
> 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
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`
> 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?
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
> 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):
#
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
> 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
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
> 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
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
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
> 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,
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 =
> 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
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"
> (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
>
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
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
> 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
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
> 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
> 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:
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'
>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
> 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
53 matches
Mail list logo