Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:48:27+00:00 2026-06-13T20:48:27+00:00

I’m trying to include a Google Maps widget in my admin-interface using this snippet

  • 0

I’m trying to include a Google Maps widget in my admin-interface using this snippet on a Linux system (presently running locally on a Bitnami django stack in VMWare Player).

The map renders, but point features (any features really) in my database are not showing up on the map, and when trying to register points through the map interface, I get an error that:

An error occurred when transforming the geometry to the SRID of the geometry form field.

I realized from the geodjango docs that the Googles spatial reference system is not included when initializing the spatialite/sqlite database, and the solution should be to issue the following commands, to add the SRS:

$ python manage shell
>>> from django.contrib.gis.utils import add_srs_entry
>>> add_srs_entry(900913)

However, when I do this from my project directory, I get:

ERROR 6: EPSG PCS/GCS code 900913 not found in EPSG support files.  Is this a valid
EPSG coordinate system?

I have confirmed that GDAL, GEOS and PROJ4 is installed, and I have added environment variables GDAL_DATA and PROJ_LIB to my .profile. I have checked the /usr/local/share/gdal/gcs.csv file which appears to not have an entry for 900913 (I have googled for other versions of gcs.csv, but none seem to contain 900913). I assume this is causing the error. However, the cubewerx_extra.wkt in the same directory does have a WKT entry for 900913.

My question is: How do I make add_srs_entry find the right SRS representation in order to add it to my database? Or is there a work-around, e.g. somehow converting the WKT representation and inserting it manually in gcs.csv?

I appreciate any help!

EDIT:
I found a way to manually insert the EPSG 900913 into the spatialite database. The solution is inspired by the sql-statement found at http:// trac.osgeo.org/openlayers/wiki/SphericalMercator (sorry, I don’t have enough reputation to post more links) and issued to the database backend using raw sql (as described in the docs at https:// docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly):

from django.db import connection, transaction
cursor = connection.cursor()
sql = "INSERT into spatial_ref_sys (srid, auth_name, auth_srid, ref_sys_name, proj4text) values (900913 ,'EPSG',900913,'Google Maps Global Mercator','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs');"
cursor.execute(sql)
transaction.commit_unless_managed()

I’ve confirmed that the entry is now in the spatial_ref_sys table. But I am still getting the same error when trying to add points in the admin-interface. Points can be added to the map, but when trying to save the feature, I get the error:

An error occurred when transforming the geometry to the SRID of the geometry form field.

Is the above sql statement correct? Is it sufficient, or does the add_srs_entry do other things as well?

Finally it could be a coding problem in my application, I will work on a minimal test-example and post it…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:48:28+00:00Added an answer on June 13, 2026 at 8:48 pm

    OK, I found the answer to the main question, as also indicated under the edit-post.

    For future reference, here is a method how to add the Google spherical projection to a spatialite database (which must be already be spatially enabled):

    1) Create a text file with the following content:

    BEGIN;

    INSERT into spatial_ref_sys (srid, auth_name, auth_srid, ref_sys_name, proj4text) values (900913,’EPSG’,900913,’Google Maps Global Mercator’,’+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs’);

    COMMIT;

    2) Save the file with a name like init_EPSG900913.sql in the directory holding you spatialite database.

    3) Issue the following command to execute the SQL statement on the database:

    spatialite some_database.sqlite < init_EPSG900913.sql

    Alternative method – From inside django-script or in “python manage.py shell”:

    from django.db import connection, transaction
    cursor = connection.cursor()
    sql = "INSERT into spatial_ref_sys (srid, auth_name, auth_srid, ref_sys_name, proj4text) values (900913 ,'EPSG',900913,'Google Maps Global Mercator','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs');"
    cursor.execute(sql)
    transaction.commit_unless_managed()
    

    With either of these two methods, your database will have the Google Maps reference sytstem registered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.