Tag Info

Hot answers tagged

8

GeoDjango also provides a lot of value-added, out-of-the-box features. Geospatially enabled admin site: This is one of my favorite features of Django in general. Django automatically creates pretty nice looking admin pages. GeoDjango takes this a step further and provides you a way to easily view and edit geospatial data using an Openlayers map. ...


7

Postgresql is quite good handling multi-cores, especially since every connection gets spawned to a new process and thereby gets handled by the OS process scheduler. I've run large postgresql databases on both windows and linux (ubuntu server) and they both perform very well. However, most likely your performance will be heavily dependent on how well your ...


7

The tolerance value is specified in map units: if two points are within the snapping tolerance, they are collapsed. So if you have geographic coordinates, simplify(1) would collapse everything to the nearest degree. Try something like simplify(0.0001) to start, or smaller depending on the resolution of your input data. You may also be interested in this ...


7

GeoDjango 1.4 supports PostGIS 2.0 with too many workarounds to make it worth it. Instead, install GeoDjango 1.5 beta which natively supports PostGIS 2.0 and switch to the official release next month.


7

Lazy geometries are not another kind of geometry. This only describes how Geodjango manages to load, instantiate and use geometry objects, and is pretty much like lazy loading in an O/R mapping framework. If you access a whole bunch of geometry data (lets say from a table), geodjango loads them in text based "Well known text" (WKT) format. If you then pick ...


6

The problem is that you've got the wrong coordinate order. WKT for SRID 4326 is longitude then latitude (think Cartesian, it is X then Y). The error is telling you that -122 is not a valid latitude. The geometry (or geography) needs to look like: SELECT ST_GeographyFromText('SRID=4326;POINT(-122 37)')... SELECT ST_GeographyFromText('SRID=4326;POINT(2 ...


5

I'd take your starting coordinate and convert it into a UTM coordinate, choosing the appropriate zone. Then, go east 1609.344 meters and south 1609.344 meters. Convert back to lat/long. For completeness I would get all four points from the UTM projection, as your square mile may actually appear to be a trapezoid on your display map.


5

There's a few ways to do this. One is to simply put the geojson of the object into a javascript variable and then render the geometry of the geojson into your map. For example, in your header of county.html you can put something like: var countyJson = {{county.geom.geojson|safe}}; You may also wish to transform the geometry into epsg:4326 before ...


5

The SQL to drop the constraint: ALTER TABLE myapp_mymodel DROP CONSTRAINT enforce_geotype_mygeom; Or to alter it to allow both Polygons & MultiPolygons: ALTER TABLE myapp_mymodel DROP CONSTRAINT enforce_geotype_mygeom; ALTER TABLE myapp_mymodel ADD CONSTRAINT enforce_geotype_mygeom CHECK (geometrytype(mygeom) = 'POLYGON'::text OR geometrytype(mygeom) ...


5

Hekevintran, Your first query is using an index just not the spatial one. See the Index Scan using geoplanet_place_pkey. So it's more efficient for it to use the id key since you are doing an ORDER by the column and your spatial filter covers the whole table. The spatial index is not used because your ST_Expand is too big. You have a geometry but its ...


5

The order of latitude and longitude has been reversed in the call self.location = Point(self.latitude, self.longitude) That is because Points expect the x-coordinate (longitude) to be the first argument. Indeed, the distance between points at latitude -74 degrees and longitudes at 4.6 and 11.0 degrees is approximately 206 kilometers.


5

You could probably migrate your data out of the Personal Geodatabase and directly into PostGIS using ogr2ogr, which supports both Personal Geodatabase and PostGIS file formats.


5

there are limitid resources for geodjango or you can find only old version of documentation on net .you cant easily find to-date information about geodjango but i can give you very good source for learning it. there is great pdf presentation for it... you can learn main functions and develop your app. with it. 1. Rapid Geographic Web Application with ...


5

As of Shapely version 1.2.14, coordinates are slicable. This looks very similar to GEOSExtractLine, where a subset of the LineString can be extracted. Here are some examples how you can slice coordinates to extract a new line object: from shapely.geometry import LineString, Point # Original LineString used for examples line = LineString([(30, 50), (60, ...


5

I really like using PostGIS for geoprocessing purposes. My two main resons is: 1) It is often very much faster to do complex tasks in the database because you get the help of the query planner to do things in the right order. 2) Just save the sql lines you used in a textfile and you have a very good documentation of what you have done. My workflow, if ...


5

GeoDjango does not currently support raster files. GeoDjango builds on top of the Geospatial Data Abstraction Library (GDAL) and, "currently, GeoDjango only supports GDAL's vector data capabilities" (strictly speaking, it supports the OGR library, a component of GDAL). Even if your database supports raster data, there are no Python hooks into that ...


4

There are some difficulties in calculating such a thing because of earth's curvature. One degree in 0º lat is bigger then in -30º lat. WARNING: don't take these as real. 1 degree longitude in 0º latitude, corresponds approximately to 111km. You can use trignometry functions to better estimate in other latitudes and calculate this in miles. There is ...


4

Figured it out. For the benefit of others, the oscode column needed to be specified as follows: ST_GeomFromText('POINT(51.146991053359 1.3585857857582)',4326),


4

It's harder than it sounds. Django Models are, at the moment, pretty tied to a SQL database world and the Admin is, in turn, pretty tied to Django models. Your best bet is probably to look at something like Django-nonrel http://www.allbuttonspressed.com/projects/django-nonrel


4

If you have one target geometry with a batch of many test geometries, try using a prepared geometry. See this page for a good description of a prepared geometry.


4

You changed your schema and the underlying tables did not get updated. When I develop on Django, I usually change my schema quite often. Unless you want to manually sync your fields through raw SQL (or even worse - drop the tables and re-create them), I would recommend you use South which is the de facto standard to keep your Django models and your DB in ...


4

Answer seems to be in this google groups thread: http://groups.google.com/group/geodjango/browse_thread/thread/b1f6e726cdcb402c/25dcef195dd093f5?lnk=gst&q=distance+between+points#25dcef195dd093f5 from django.contrib.gis.geos import Point, GEOSGeometry pnt = GEOSGeometry('SRID=4326;POINT(40.396764 -3.68042)') pnt2 = GEOSGeometry('SRID=4326;POINT( ...


4

Rather basic answer to your interesting question. Django is a mature web framework. Geodjango is a set of classes allowing you to edit/save/display geospatial data types via the admin module or your own web pages (by employing openLayer in the background). This is fun/impressive but Geodjango doesn't do very much else per se. Geoserver is a web mapping ...


4

try to read Improving the Admin from http://blog.adamfast.com/ {% extends "gis/admin/openlayers.js" %} {% block extra_layers %} topo_layer = new OpenLayers.Layer.WMS( "USA Topo", "http://terraservice.net/ogcmap.ashx", {layers: 'DRG'} ); {{ module }}.map.addLayer(topo_layer); nexrad_layer = new OpenLayers.Layer.WMS( "NEXRAD", ...


4

The geographic data type is quite new and it doesn't have so many functions as the geometric data type. Never the less it has some important functions that take into account the great circle calculations when dealing with length units. Currently you can take advantage of geog data type even if you are using the geometry, by casting from one type to another ...


4

There's an excellent tutorial within the Django documentation I recommend you check out. Here is the highlight reel... Create your database; set up your Django project. $ createdb -T template_postgis my_new_db $ django-admin.py startproject my_new_project $ cd my_new_project $ python manage.py startapp my_new_app Next, define the geographic model for ...


3

It's entirely possible, but nobody's done it yet. Arc2Earth uses an independent implementation of the Esri REST API to host on Google App Engine. And implementing the REST API makes it possible to do things like expose geoprocessing services and feature layers for analysis in ArcGIS Explorer.


3

A couple of ways you can solve this: you could switch out your geometry field for a geography field within GeoDjango, then any native area calls should return values in meters which can easily be converted to the units you're interested in. If you want to stick to storing things in geographic space as plain geometries, then you'll need to do conversion ...


3

Just change cities = City.objects.filter(location__within=boundaries) To cities = City.objects.filter(location__within=boundaries).distance(centre).order_by('distance') Each City object will also have a 'distance' attribute.



Only top voted, non community-wiki answers of a minimum length are eligible