Guillame,

Absolutely. GeoDjango can be used to read new or existing geographic
datasources from dozens of formats. GeoDjango provides a ctypes
interface to the foundational GDAL/OGR library, which is the open
source industry standard for format translation. Look for the utility
called `orginspect`.

While the GeoDjango documentation is still being worked on, the
Docstrings are excellent.  To see how ogrinspect works you'll need to
do nothing but (a sample project and shapefile can be downloaded from
http://code.google.com/p/geodjango-basic-apps/wiki/GeographicAdminQuickStart):

>>> from django.contrib.gis.utils import ogrinspect
>>> help(ogrinspect)


Help on function ogrinspect in module
django.contrib.gis.utils.ogrinspect:

ogrinspect(*args, **kwargs)
    Given a data source (either a string or a DataSource object) and a
string
    model name this function will generate a GeoDjango model.

    Usage:

    >>> from django.contrib.gis.utils import ogrinspect
    >>> ogrinspect('/path/to/shapefile.shp','NewModel')

    ...will print model definition to stout

    or put this in a python script and use to redirect the output to a
new
    model like:

    $ python generate_model.py > myapp/models.py

    # generate_model.py
    from django.contrib.gis.utils import ogrinspect
    shp_file = 'data/mapping_hacks/world_borders.shp'
    model_name = 'WorldBorders'

    print ogrinspect(shp_file, model_name, multi_geom=True, srid=4326,
                     geom_name='shapes', blank=True)
:

Cheers,

Dane


On Aug 13, 12:39 am, guillaume <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I'm pretty glad to see that GeoDjango has joined the main trunk. As it
> is a great tool for managing geographic data, I am wondering if it is
> possible to create a new model dynamically. Imagine you want to add a
> new geographic data source to your app, how can it be done ?
>
> Regards,
>
> Guillaume
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to