mapbox / mapbox-studio-classic

https://www.mapbox.com/mapbox-studio/
BSD 3-Clause "New" or "Revised" License
1.14k stars 229 forks source link

PostGIS layers not showing #1490

Closed majesticpdx closed 8 years ago

majesticpdx commented 8 years ago

I'm not sure if this is the correct place for this possible bug, however, I've been trying to find a solution over the last couple of days.

After using the basic ogr2ogr example, the layers are not showing using PostGIS layers.

1) I've confirmed that the data is present after adding PostGIS layer, including the correct geometry column. a) If uploading a .csv or .shp, the layers are displayed as expected. b) I've also confirmed that there are not issues with the PostGIS layer(s) by adding the layers using QGIS. c) Several of the basic SQL quarries have been tried, with the same result. d) Zooming to layer extent has also been attempted, however, #1487 has also been a problem. e) Both, WGS84 and 900913, have been attempted.

screenshot from 2015-10-28 05 18 44

screenshot from 2015-10-28 05 20 34

screenshot from 2015-10-28 05 24 12

If anyone has any suggestions, it would be appreciated.

wilhelmberg commented 8 years ago

d) Zooming to layer extent has also been attempted, however, #1487 has also been a problem.

Looks like you are using Studio Classic from Github source? Would you mind trying this branch, which is a first step to solve the zoom-to-extent-problem? https://github.com/mapbox/mapbox-studio-classic/tree/src-zoom-to-extent

c) Several of the basic SQL quarries have been tried, with the same result.

Could you share the queries? And, if possible, the data, for me to replicate?

majesticpdx commented 8 years ago

Sure,

1) Here are some of the quarries I've tried so far:

a) table_name changed to the correct table b) postgis-vt-util.sql loaded

( SELECT * FROM table_name
  WHERE wkb_geometry && !bbox!
) AS data

( SELECT * FROM table_name
  WHERE z(!scale_denominator!) >= 12
  AND wkb_geometry && !bbox!
) AS data

( SELECT * FROM table_name ) AS data

2) Data sources -- here are a couple that I'm working with, both .shp and the complete .zip are included.

https://drive.google.com/folderview?id=0B8D5So4x7orRYURhLWFPaTBMZTg&usp=sharing

wilhelmberg commented 8 years ago

Thanks for the data. Seems you forgot to the -t_srs EPSG:3857 parameter when importing from PostGIS, as they are in NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601_Feet_Intl coordinate system. PostGIS layers need to be either in WGS84 or WebMercator.

wilhelmberg commented 8 years ago

Or even easier, export it to PostGIS from QGIS via DB Manager:

image

majesticpdx commented 8 years ago

I wish it were that simple. The sources I uploaded had not been re-projected yet.

Here is the string I am using for each:

ogr2ogr -f PostgreSQL -t_srs EPSG:3857 PG:'user=**** host=*********** password=*********** dbname=MapBox' ...filepath/Streets/streets.shp
wilhelmberg commented 8 years ago

Works for me. I imported the shapefiles you provided into PostGIS directly from QGIS with the settings of the previous screenshot.

image

wilhelmberg commented 8 years ago

Stale.