Active Topics

 


Reply
Thread Tools
Posts: 58 | Thanked: 223 times | Joined on Apr 2017 @ Germany
#41
Looks good now. Poow Maps GL and Demo app both work in online and offline mode. Good work!
 

The Following 2 Users Say Thank You to jdrescher For This Useful Post:
Posts: 58 | Thanked: 223 times | Joined on Apr 2017 @ Germany
#42
@rinigus another question:
on double tap on the map I want to zoom in and center the map at this position. Problem is the fitView does not work. I tried:
Code:
onDoubleClicked:
            {
                console.log("onDoubleClicked: " + mouse)
                map.setZoomLevel(map.zoomLevel + 1, Qt.point(mouse.x, mouse.y) );
            }
            onDoubleClickedGeo:
            {
                console.log("onDoubleClickedGeo: " + geocoordinate);
                map.fitView(geocoordinate);    //TODO: does not work!
            }
I have also problems with fitView if I want to center on a specific coordinate, it just does not work:
Code:
map.fitView(QtPositioning.coordinate(51.9854, 9.2743));  //TODO does not work!
 

The Following 2 Users Say Thank You to jdrescher For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#43
Originally Posted by jdrescher View Post
@rinigus another question:
on double tap on the map I want to zoom in and center the map at this position. Problem is the fitView does not work. I tried:
Code:
onDoubleClicked:
            {
                console.log("onDoubleClicked: " + mouse)
                map.setZoomLevel(map.zoomLevel + 1, Qt.point(mouse.x, mouse.y) );
            }
            onDoubleClickedGeo:
            {
                console.log("onDoubleClickedGeo: " + geocoordinate);
                map.fitView(geocoordinate);    //TODO: does not work!
            }
I have also problems with fitView if I want to center on a specific coordinate, it just does not work:
Code:
map.fitView(QtPositioning.coordinate(51.9854, 9.2743));  //TODO does not work!
Morning! Try to give it as a list:

Code:
map.fitView([geocoordinate]);
An example use in Poor Maps GL: https://github.com/rinigus/poor-maps...l/Map.qml#L400

Its designed to fit many points, but should fit one point as well. I have added an issue to improve the documentation in this respect. Please let me know if it helps. And let me know here or file issues at https://github.com/rinigus/mapbox-gl-qml/issues if something is not clear.
 

The Following 3 Users Say Thank You to rinigus For This Useful Post:
Posts: 58 | Thanked: 223 times | Joined on Apr 2017 @ Germany
#44
Ah sorry, it's been too early on monday morning
I've somehow misunderstood the purpose of fitView function. What I really needed was the center property. Now everything works properly
 

The Following 3 Users Say Thank You to jdrescher For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#45
Originally Posted by jdrescher View Post
Ah sorry, it's been too early on monday morning
I've somehow misunderstood the purpose of fitView function. What I really needed was the center property. Now everything works properly
It's great that you report even when you misunderstand! That way we can improve the documentation and it will be easier for others. So, please keep the questions coming
 

The Following User Says Thank You to rinigus For This Useful Post:
Posts: 58 | Thanked: 223 times | Joined on Apr 2017 @ Germany
#46
I'm sorry, but I have an other question.
I want to place an image on the map. I looked into the api and also in the sources of poor maps GL and came up with this:
Code:
map.addImagePath("image", Qt.resolvedUrl(app.getIcon("./images/position.png")))

map.addLayer("image_layer", {"type": "symbol", "source": "source_name"});
map.setLayoutProperty(constants.layerStill, "icon-image", "image");
map.setLayoutProperty(constants.layerStill, "icon-size", 1.0 / map.pixelRatio);
map.setLayoutProperty(constants.layerStill, "visibility", "visible");
There is no error but also no icon on the map. It's also unclear where do I have to put the coordinates?
 

The Following 2 Users Say Thank You to jdrescher For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#47
Originally Posted by jdrescher View Post
I'm sorry, but I have an other question.
I want to place an image on the map. I looked into the api and also in the sources of poor maps GL and came up with this:
Code:
map.addImagePath("image", Qt.resolvedUrl(app.getIcon("./images/position.png")))

map.addLayer("image_layer", {"type": "symbol", "source": "source_name"});
map.setLayoutProperty(constants.layerStill, "icon-image", "image");
map.setLayoutProperty(constants.layerStill, "icon-size", 1.0 / map.pixelRatio);
map.setLayoutProperty(constants.layerStill, "visibility", "visible");
There is no error but also no icon on the map. It's also unclear where do I have to put the coordinates?
You are very close. You are just missing definition of the source - "source_name". Example would be here: https://github.com/rinigus/poor-maps...Marker.qml#L42

So, in your code, before adding a layer using the source, you have to add source as well:

Code:
map.addSourcePoint("source_name",  some_coordinate)
Later you can modify its location by corresponding API functions and don't have to do anything with the layers.

PS: Its frequent when Mapbox GL doesn't give any decent feedback in terms of errors, unfortunately.
 

The Following 4 Users Say Thank You to rinigus For This Useful Post:
Posts: 58 | Thanked: 223 times | Joined on Apr 2017 @ Germany
#48
Originally Posted by rinigus View Post
You are very close. You are just missing definition of the source - "source_name".
Thanks, somehow I overlooked that.
There were some other small bugs, but now it works:
Code:
map.addSourcePoint("source_name",  QtPositioning.coordinate(51.9854, 9.2743));
map.addImagePath("image", Qt.resolvedUrl("./images/position-circle-blue.png"));

map.addLayer("image_layer", {"type": "symbol", "source": "source_name"});
map.setLayoutProperty("image_layer", "icon-image", "image");
map.setLayoutProperty("image_layer", "icon-size", 1.0 / map.pixelRatio);
map.setLayoutProperty("image_layer", "visibility", "visible");
 

The Following 5 Users Say Thank You to jdrescher For This Useful Post:
Posts: 1,746 | Thanked: 1,832 times | Joined on Dec 2010
#49
turns out mapbox has a geocoding api too, going for the full suite
 

The Following User Says Thank You to m4r0v3r For This Useful Post:
Posts: 959 | Thanked: 3,427 times | Joined on Apr 2012
#50
yep, currently using Mapbox's geocoding API in Saera's voice directions module.
 

The Following 2 Users Say Thank You to taixzo For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 18:02.