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'm seeking a function that converts degrees to the following format:

POINT(405115.926025391 4543389.4354248)

I dont know this format's name, but is there any function to do so?

Cheers,

EDIT ------- > converting SRID

WITH currentPoint AS (
    SELECT
        st_transform(st_setsrid(st_makepoint(3.6392182823950043, 37.74446159789074), 900913), 900913) AS point
)
SELECT 
    building.gid
FROM 
    building, currentPoint 
WHERE
    ST_Dwithin(building.geom, currentPoint .point, 10)
share|improve this question

2 Answers 2

i dont know but it looks like SRID EPSG:900913 - Google Map Web Mercator.

you can try this:

UPDATE myTable SET  the_geom = ST_Transform(the_geom,900913);

SELECT UpdateGeometrySRID('myTable', 'the_geom', 900913);

i have tested your coordinates in any openlayers page with using this and it gives me this result:

new OpenLayers.Geometry.Point(405115.926025391, 4543389.4354248)
.transform(new OpenLayers.Projection('EPSG:900913'), new OpenLayers.Projection('EPSG:4326'));

the returned result:

POINT(3.6392182823950043 37.74446159789074) { id=    
"OpenLayers_Geometry_Point_865"    
, x=    
3.6392182823950043    
, y=    
37.74446159789074    
, more...}

i hope it helps you...

share|improve this answer
    
thanks Aragon for quick response, now this is what I get "transform: couldn't project point" –  Kourosh Dec 3 '12 at 15:39
1  
check out if you have EPSG:900913 in your spatial_ref. SELECT proj4text FROM spatial_ref_sys WHERE srid = 900913; –  Aragon Dec 3 '12 at 15:46
    
yes, I do have this SRID, I've updated my question based on your answer, but still not on the right path, cause I get error, am I making an obvious mistake? thanks –  Kourosh Dec 3 '12 at 15:57
    
You need to define your starting point as SRID 4326 and convert it to 900913. It looks like you're doing it the other way around. –  Mintx Dec 3 '12 at 18:30

There's two obvious errors:

st_transform(st_setsrid(st_makepoint(3.6392182823950043, 37.74446159789074), 900913), 900913) AS point

It seems, you want to convert from 4326 to 900913, so you have to: 1) create point with ST_MakePoint 2) set it's SRID to 4326 with ST_SetSRID 3) Transform it to 900913 with ST_Transform

st_transform(st_setsrid(st_makepoint(3.6392182823950043, 37.74446159789074), 4326), 900913) AS point

Probably it's typo (extra space) in

ST_Dwithin(building.geom, currentPoint .point, 10)

and you mean

ST_Dwithin(building.geom, currentPoint.point, 10)

BTW, you are looking for buildings, that are within 10 SRID units (lets say 10 meters, to keep things simple) from given point, that's quite a small distance.

share|improve this answer

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.