2

I'm trying to plot some weather.gov grids in PGAdmin, but the polygon is way off the map enter image description here

Doing some searching, I believe ST_GeomFromText('POLYGON((x1 y1, x2 y2....xn, yn, x1, y1))') is what I'm needing to use, and then to cast that to Geography?

select ST_GeomFromText('POLYGON((-121.2163539 42.233639799999999,-121.21070950000001 42.212291899999997,-121.1818863 42.216468899999995,-121.1875249 42.237817199999995,-121.2163539 42.233639799999999))',4326)::geography;

the original coordinates that should be contained in this polygon are 42.1958,-121.2182

I'm probably missing a core concept, but am not sure which... If I remove the SRID, it appears the longitude is correct, but I end up in the northern territories of Canada...

5
  • 1
    try gis.stackexchange.com/a/220115/276
    – Mapperz
    Commented Nov 12, 2022 at 3:01
  • @Mapperz if you're referring to the position of the lat,lon... I am using the format of lon1 lat1, lon2 lat2... Commented Nov 13, 2022 at 2:28
  • That's likely an issue with the pgAdmin mapping widget trying to make sense of the GEOGRAPHY type - the Polygon in your statement is just East of Goodlow Mountain in Oregon. Start reading the PostGIS topics section on the GEOGRAPHY type and find answers on GIS.SE for all follow-up questions you may have - bottom line is, you should have a reason to choose GEOGRAPHY over the base GEOMETRY type, and know a little about the pros and cons of both types.
    – geozelot
    Commented Nov 14, 2022 at 14:10
  • Thanks @geozelot! I'll admit I'm in over my head in a bit of this, especially since I'm just really needing small bits of pieces of GIS for this project. I ended up using Poltly to graph the grids and it's working perfectly. Commented Nov 15, 2022 at 0:52
  • 1
    turns out it was indeed a problem with pgAdmin mapping. the map is tiled\repeated when zoomed out, and for whatever reason I was only seeing 1 of those repeated tiles. and not where it should have been. a reinstall fixed the issue. Commented Nov 18, 2022 at 0:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.