3

Using google maps I have located 4 points and have created a polygon with them in this way

insert into dummy_zip values (4,'prueba_directa','2016-04-13 08:08:15.973731','prueba_directa',1,1,100,'2016-04-13 08:08:15.973731',(SELECT ST_Transform(ST_GeomFromText('MULTIPOLYGON(((37.986504 -1.121951,37.986741 -1.121243,37.985794 -1.120792,37.985608 -1.121479,37.986504 -1.121951)))',4326),900913)));

I use the camptocamp example base_geoengine_demo for odoo (openERP 8), only can use the 900913, but i don't use google maps i use OpenStreetMap, if i use distinct 900913 i obtain a error "ERROR: Geometry SRID (0) does not match column SRID (900913)"

but when displayed on the map they are in a completely different location than where they should be?

  • In Google Maps, the tiles are generated using 900913, these days known as 3857, whereas vector data uses 4326. Therefore, there is no need to transform the coordinates. Just upload them as they are, as lat/lon, 4326. The answer of GIS_lover is misleading and partially wrong. – John Powell Apr 14 '16 at 13:25
  • If you add a working example, jsFiddle or similar, it is easier for people to help you. – John Powell Apr 14 '16 at 13:27
  • I use the camptocamp example base_geoengine_demo for odoo (openERP 8), only can use the 900913, but i don't use google maps i use OpenStreetMap, if i use distinct 900913 i obtain a error – josemi Apr 14 '16 at 14:11
  • 1
    The Polygon data is now in Kenya. Where do you expect it to be? If you want La Condomina in Murcia/Spain, you have to swap the coordinates. WKT expects longitude-latitude order. – AndreJ Apr 14 '16 at 14:45
  • 1
    So take MULTIPOLYGON(((-1.121951 37.986504,-1.121243 37.986741,-1.120792 37.985794,-1.121479 37.985608,-1.121951 37.986504))) – AndreJ Apr 14 '16 at 14:47
2

As you know and is clear from the coordinates in your code:

37.986504 -1.121951,37.986741 -1.121243,37.985794 -1.120792,37.985608 -1.121479,37.986504 -1.121951  

google maps uses the Geographic Coordinate System WGS 1984

Then what is the coordinate system of the polygon in your code?
Does your code apply this coordinate system (wgs1984) on the polygon?
If not, then your polygon's coordinate system is undefined and so when importing the layer(polygon) into a GIS software to display it on a map, the software doesn't know which algorithm should be used to convert the coordinates of the layer(polygon) to the coordinates of the map and show it in the right place. So, by default it considers the coordinate system of the map for the layer(polygon).
And if it's right by accident, the layer(polygon) will be shown in the right place.
otherwise the layer(polygon) will be shown in a wrong place.

  • So, probably you haven't defined WGS1984 coordinate system for your polygon in your code and also the coordinate system of the map is not WGS1984.

  • Try to define the coordinate system of the polygon in the code.

  • 1
    Technically, WGS84 is the geoid, not the CRS, 4326. There are other CRSs based on WGS84. Google Maps uses 4326 for overlay data that are uploaded, and the tiling system is based on 3857 (or what used to be called 900913, as in the OP's question). – John Powell Apr 14 '16 at 14:21
0

I mistook longitude and latitude, the correct sentence is

insert into dummy_zip values (4,'prueba_directa','2016-04-13 08:08:15.973731','prueba_directa',1,1,100,'2016-04-13 08:08:15.973731',(SELECT ST_Transform(ST_GeomFromText('MULTIPOLYGON(((-1.121951 37.986504,-1.121243 37.986741,-1.120792 37.985794,-1.121479 37.985608,-1.121951 37.986504)))',4326),900913)));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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