Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have loaded a shapefile into a SpatiaLite Database using the spatialite-gui. In which table is the Spatial reference ID or EPSG code (of the stored data)stored in SpatiaLite?

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

The table that holds the description is spatial_ref_sys. The id is contained in the geometry binary blob.

share|improve this answer
    
Maybe I am doing something wrong here, but when I run "select aswkt(geometry) from Buildings where Id =3;" I do not get the epsg code in the output. Does that mean that the spatial reference for my Buildings Table is not saved? –  Devdatta Tengshe Jan 4 '13 at 6:40
1  
No, it means that the WKT format (en.wikipedia.org/wiki/Well-known_text) doesn't specify the SRID. Try AsEwkt() if you'd like the SRID included. You can also just ask for SRID(geometry) if you just want the id. Note that there is a chance that your SRID is not an EPSG SRID, but its unlikely unless you used something exotic on input. –  BradHards Jan 4 '13 at 7:08
    
Basically I wanted to project Geometries to a UTM projection if they were not in UTM already, so as to get distances in Meters. I see that SRID(Geometry) also works when you use it in a query. Thanks. –  Devdatta Tengshe Jan 4 '13 at 7:28
    
That should be no problem (as long as you know which UTM zone you want). gaia-gis.it/gaia-sins/spatialite-sql-4.0.0.html#p15 will give you the Transform() function. –  BradHards Jan 4 '13 at 7:35
    
@DevdattaTengshe: does this answer the question / solve your problem for now? –  BradHards Jan 6 '13 at 21:57
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.