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

Added command line utility to test out the library interface #12

Merged
merged 2 commits into from
Aug 27, 2018

Conversation

gdey
Copy link
Member

@gdey gdey commented Aug 26, 2018

Add a command line utility to test out the library interface
Added include directives to camera_options.go to allow it to
find c/c++ libraries.

Add a command line utility to test out the library interface
Added include directives to camera_options.go to allow it to
find c/c++ libraries.
img = ss.Snapshot(&FBounds, size)

case CmdTile:
img = mbgl.SnapshotTile(ss, FTile, size)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ear7h I think instead of size, which is difficult to understand what is going on here. Since you are setting the X, Y for width and height. I think instead you should just take a width and height parameter of type uint.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, these should return errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors need to be implemented on the C side. #1 is tracking this and I currently put in a suggestion for this using macros

@gdey
Copy link
Member Author

gdey commented Aug 26, 2018

@ear7h I only have one comment. Not much of any api really which is good. We need to improve the documentation quite a bit.

@gdey
Copy link
Member Author

gdey commented Aug 26, 2018

I need some help testing this as I get the following errors:
for:
./snapshot -h 1024 -w 1024 tile "3/6/2" 3_6_2.png
I get:

objc[73571]: Class MBGLBundleCanary is implemented in both /Library/Frameworks/Mapbox.framework/Versions/A/Mapbox (0x62
1b798) and /Users/gdey/go/src/github.com/go-spatial/go-mbgl/cmd/snapshot/./snapshot (0x4f13d00). One of the two will be
 used. Which one is undefined.
2018-08-26 13:51:23.070 snapshot[73571:52050728] [INFO] {com.mapbox.mbgl.Map Snapshotter}[General]: GPU Identifier: AMD
 Radeon Pro 460 OpenGL Engine
2018-08-26 13:51:25.014 snapshot[73571:52050723] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:51:25.014 snapshot[73571:52050728] [WARNING] {com.mapbox.mbgl.Map Snapshotter}[ParseStyle]: current rende
rer implementation only supports style spec version 8; using an outdated style will cause rendering errors

For
/snapshot -h 1024 -w 1024 -style "http://localhost:8080/maps/osm_land/style.json" tile "3/6/2" 3_6_2.png
I get:

objc[73532]: Class MBGLBundleCanary is implemented in both /Library/Frameworks/Mapbox.framework/Versions/A/Mapbox (0x62
1b798) and /Users/gdey/go/src/github.com/go-spatial/go-mbgl/cmd/snapshot/./snapshot (0x4f13d00). One of the two will be
 used. Which one is undefined.
2018-08-26 13:49:16.885 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:16.898 snapshot[73532:52048342] [INFO] {com.mapbox.mbgl.Map Snapshotter}[General]: GPU Identifier: AMD
 Radeon Pro 460 OpenGL Engine
2018-08-26 13:49:16.970 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:17.170 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:17.887 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:17.901 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:18.134 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:18.903 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:19.893 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:19.895 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:20.097 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:20.897 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:22.900 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:23.896 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:23.899 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:24.131 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:24.902 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:26.905 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:29.326 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:30.908 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:31.898 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:31.901 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:32.133 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:32.903 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:34.905 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:37.438 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:38.907 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:46.910 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:47.901 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:47.903 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:48.073 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:48.905 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:50.907 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:53.306 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:49:54.912 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:50:02.914 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:50:12.080 snapshot[73532:52048337] [INFO] {com.mapbox.mbgl.DefaultFileSour}[Database]: Unable to make spa
ce for entry
2018-08-26 13:50:18.828 snapshot[73532:52048342] [ERROR] {com.mapbox.mbgl.Map Snapshotter}[Style]: Failed to load tile
3/6/3=>3 for source osm_land: The request timed out.
errThe request timed out.
2018/08/26 13:50:18 Failed to write %v 3_6_2.png
2018/08/26 13:50:18 png: invalid format: invalid image size: 0x0

@ear7h
Copy link
Collaborator

ear7h commented Aug 26, 2018

The second issue is related to #11. Not sure what to do about the style out of date problem


/*
#cgo CXXFLAGS:-I${SRCDIR}/../mapbox-gl-native/include
#cgo CXXFLAGS:-I${SRCDIR}/../mapbox-gl-native/platform/default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move these to mbgl.go, I want to keep the compiler directives in one file to easily keep track of them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we will need to have these things be on a per OS bases soon. I did this just to get this out.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is currently split up by OS (see mbgl_darwin.go and mbgl_linux.go) although, I haven't tested the bindings on linux.

img = ss.Snapshot(&FBounds, size)

case CmdTile:
img = mbgl.SnapshotTile(ss, FTile, size)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors need to be implemented on the C side. #1 is tracking this and I currently put in a suggestion for this using macros

for i, part := range parts {
switch i {
case 0:
v, err = strconv.ParseUint(strings.TrimSpace(part), 10, 64)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be outside of the switch statement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

Copy link
Collaborator

@ear7h ear7h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ear7h ear7h merged commit 8aa936f into master Aug 27, 2018
@ear7h ear7h deleted the testCommandline branch August 27, 2018 18:30
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

Successfully merging this pull request may close these issues.

2 participants