Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a proj query parameter for rendering in various projections #267

Open
singram7 opened this issue Jan 23, 2018 · 15 comments
Open

Support a proj query parameter for rendering in various projections #267

singram7 opened this issue Jan 23, 2018 · 15 comments

Comments

@singram7
Copy link

Vector Tiles have no projection, thus any cylindrical projection on the WGS84 Datum can be rendered into Vector Tiles in meters. The default is currently web-mercator (3857), but 3395 (Elliptical Mercator) could be supported.

@ARolek
Copy link
Member

ARolek commented Jan 24, 2018

@singram7 I agree. @gdey and I talked through this today and we're going to add this to the v0.7.0 release. We want to implement more robust projection handling and will use 3395 as second projection system we will support.

Your idea with using a query string is interesting. Though this is completely possible I need to think through some of the caching ramifications. I'm initially inclined to have the map projection be configurable by the user rather than the requester, though I could see the use case for the later.

Thanks for the suggestion. The timing lines up perfectly with the development discussions we're having on this end.

@ARolek ARolek added this to the v0.7.0 milestone Jan 24, 2018
@JivanAmara
Copy link
Contributor

JivanAmara commented Jan 24, 2018

@singram7, @ARolek, I understand mapbox only supports 3857. What other map clients beyond mapbox are being used w/ tegola making additional projections requested from the client side useful?

@jj0hns0n
Copy link
Contributor

@JivanAmara OpenLayers supports any projection essentially.

@mpgerlek
Copy link

@ARolek - what would you like the proj API to support, to give you this use case? Do you want proj strings, or something else?

@jj0hns0n
Copy link
Contributor

@singram7 also curious your thoughts here.

@ARolek
Copy link
Member

ARolek commented Apr 13, 2018

@mpgerlek from an user's perspective I think it would be ideal to use SRID values. This could then be leveraged in the tegola config, query strings for tile requests, and it's also the value we work with when determining if a geometry from a data provider needs re-projection.

For the proj project have you considered generating Go code from a list of projection strings? In an ideal world an interface could be established that all the projections could leverage and tegola would be able to call a method like (rough sketch):

var p []float64{32.715738,-117.161084}

// proj.Project(from, to uint, point ...float64) ([]float64, error)
p, err := proj.Project(4326, 3857, p...)
if err != nil{
  // handle err
}

@mpgerlek
Copy link

Do we have a means to generate the proj string from an arbitrary SRID? Or are you thinking about just hardcoding in support for a handful of well-known epsg codes?

I'm not sure what you mean by "generate code" -- are you thinking about generating the actual AST on the fly can then calling into it, or..?

@singram7
Copy link
Author

singram7 commented Apr 13, 2018 via email

@ARolek
Copy link
Member

ARolek commented Apr 13, 2018

@mpgerlek I was thinking more about having the SRID "hardcoded". Another way to think about this is using a registration type system, like Go does with the image package. We also take this approach with data providers and cache backends in tegola. This would also allow for @singram7 to to register a custom projection code (though it would require a custom build of tegola).

Re: generating code. I'm more referring to a way to automate parsing the proj4 codes and generating the Go code which would adhere to a common interface. I have not worked too much with proj4 strings so I'm not quite sure if this is possible. Ideally the proj package would have a list of ESPG codes and their respective proj4 strings, which we could then use to generate Go code that would make up much of the proj package. Want to add a new ESPG code? Add it ands the pro4 string to the list and regenerate.

Again, I don't know if this is possible based on my limited knowledge around proj4 strings, but this is the high level idea.

@mpgerlek
Copy link

mpgerlek commented Apr 14, 2018

the proj4go part of this thread has been moved to go-spatial/proj#3

@fgravin
Copy link

fgravin commented May 29, 2018

Would be great to have custom projection for vector tiles output.
+1

@ARolek
Copy link
Member

ARolek commented May 29, 2018

@fgravin we're going to be bringing in the proj package into tegola during our v0.8.0 release cycle. The package currently supports 3395, 4396 and 3857 projections. If you would like additional ones supported you can open issues there, or send in PRs ;-).

@ARolek ARolek modified the milestones: v0.7.0, v0.8.0 Jun 11, 2018
@RobertSasak
Copy link

I would like to add projection 25833. Where should I start to look?

@gdey
Copy link
Member

gdey commented Jul 2, 2018

@RobertSasak

Currently, the projection system in Tegola only supports transforming data in a different projection to webmercator. At current the render system only outputs to webmercator. The proj project will help us to remove this limitation.

Well it depends on which direction you want to go:

  1. the quick way would be to adapt the current system, that will be thrown away.
  1. The long way, which would be to add it to the proj package, and then integrate that into tegola. This is the long-term direction. This will probably take quite some time, and I have not had the time to look over the proj package and code review it. This is my plan after the refactor of the math and geom package which is what I'm doing now.

@RobertSasak
Copy link

Thank you for a quick reply. As I am only playing with data I found the easiest to convert all data to correct projection directly in DB.

Below is my sql script. First I select all tables that contain myColumn and then I concat ALTER command.

select 
'ALTER TABLE ' || table_schema || '.'|| table_name || '
 ALTER COLUMN myColumn TYPE geometry(Geometry,3857) 
  USING ST_Transform(myColumn,3857);
'
 FROM information_schema.columns WHERE column_name = 'myColumn';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants