camptocamp / c2cgeoportal

c2cgeoportal application
http://geomapfish.org
Other
64 stars 46 forks source link

Mobile - Marker when passing coordinates #1195

Closed kalbermattenm closed 9 years ago

kalbermattenm commented 9 years ago

Is there an "easy" way to implement the display of a marker in the mobile app when passing coordinates & zoom through the URL ?

The idea would be to add a custom variable in the URL and to display the map overlaid by a marker (located on the passed coordinates) if this variable exists, something like:

http://example.com/mobile?map_x=554225&map_y=200210&map_zoom=12&marker=1

(This is fake...) example

kalbermattenm commented 9 years ago

@gnerred and @rbovard, would that be something interesting for you ?

gnerred commented 9 years ago

Yes it would be interesting

rbovard commented 9 years ago

Why not, but maybe also think about adding this to the desktop version.

I like the way how OSM.org included this feature in the permalink:

image

kalbermattenm commented 9 years ago

Could you give an example of permalink ? I can't reproduce it (yeah... don't ask...) on openstreetmap.org and I would like to see what is the name of the variable ?

rbovard commented 9 years ago

It seems the marker can be not in the middle of the map: http://www.openstreetmap.org/?mlat=46.38231&mlon=6.24008#map=19/46.38231/6.24008

rbovard commented 9 years ago

FYI to add the marker when generating the permalink:

image

kalbermattenm commented 9 years ago

Thanks I did see that, but didn't get that there wasn't a query variable explicitly defining the marker...

Personally, I would rather have a marker added only when it is explicitly declared as a variable... Something like ...&addMarker

rbovard commented 9 years ago

Yes I think your first proposal is fine, the marker is in the middle of the map.

The reference to OSM was more about how to add a marker when generating a permalink.

sbrunner commented 9 years ago

Just an additional info: With Ext it's not possible to have a paramer like marker=1 the parameter should be named as map_marker if it's the map component who manage the marker. Otherwise that looks good :-)

kalbermattenm commented 9 years ago

I have done something...

The code is here: https://github.com/camptocamp/sitn_c2cgeoportal/pull/852

The demo is here: http://sitn.ne.ch/dev_internet/mobile/?map_x=549600&map_y=206050&map_zoom=8&map_marker=1

Yeah I know... The marker is not the most beautiful marker of all time...

I followed @sbrunner's advice and called the variable map_marker

This modifies code which is part of the c2cgeoportal, do you think it would be good to directly integrate it into this one ?

gnerred commented 9 years ago

Looks good, but you have two markers, one in the center and one on top left.

I think it will be usefull to add a tooltip to the marker. Instead of map_marker=1, you could set map_marker=BLABLA and the blabla becomes "interrogeable". We did that on the very first version of GeoMapfish desktop...

http://map.cartoriviera.ch/theme/cadastre?map_x=560000&map_y=142000&map_zoom=5&map_tooltip=BLABLA

kalbermattenm commented 9 years ago

Looks good, but you have two markers, one in the center and one on top left.

Cool... I don't know how I managed that...

I think it will be usefull to add a tooltip to the marker. Instead of map_marker=1, you could set map_marker=BLABLA and the blabla becomes "interrogeable". We did that on the very first version of GeoMapfish desktop...

Hmmm... This is going to be quite complicated on the mobile... We don't have Ext.Window and to integrate this directly into the map using seems quite complicated to me...

Maybe @pgiraud would have some advices on this...

In the mean time, I'm going to make the upper left marker disappear ;-)

gnerred commented 9 years ago

Okay so forget my proposal if it is not super easy. You could also look for a smarter marker ;O)

gnerred commented 9 years ago

For the tooltip, couldn't you use the same methods as in the API ?

kalbermattenm commented 9 years ago

You could also look for a smarter marker ;O)

Indeed, that would be a good idea...

For the tooltip, couldn't you use the same methods as in the API ?

It there a tooltip in the API ? Would you have an example ?

kalbermattenm commented 9 years ago

I have a weird side effect...

Two markers (one on the top left): http://sitn.ne.ch/dev_internet/mobile/?theme=mobile_default&baselayer_ref=plan_ville&map_x=549600&map_y=206050&map_zoom=8&map_marker=1&tree_layers=

One marker (as expected...): http://sitn.ne.ch/dev_internet/mobile/?theme=mobile_default&baselayer_ref=plan_ville&map_x=548947&map_y=206266&map_zoom=8&map_marker=1&tree_layers=

I just moved a bit the map (map_x and map_y are slightly different).

I will have to investigate that, because I checked in the OL layer containing the marker and there is only one of them...

kalbermattenm commented 9 years ago

OK, I found the bug and modified the image.

@gnerred, what do you think (use the above links, but don't forget to empty your cache...)

gnerred commented 9 years ago

Yeah that's cool, good job :O)

sbrunner commented 9 years ago

Nice :-)

kalbermattenm commented 9 years ago

Thanks ;-)

@sbrunner, would it make sense to submit a PR with that (cleaned up, CONST_changelog updated and adding documentation) to the c2cgeoportal project (branch 1.5) ?

sbrunner commented 9 years ago

For me in the master branch it's relay good, but for me it's a too big change for the 1.5 branch...

kalbermattenm commented 9 years ago

@gnerred and @rbovard, I suggested a PR for the mobile app.

I didn't know that in the desktop app there was already something like that. For instance, try:

http://sitn.ne.ch/theme/main?map_x=538075.0&map_y=199075.0&map_zoom=10&map_crosshair=1

rbovard commented 9 years ago

Thanks for the work!

I didn't know about this functionality, it's a little hidden since we cannot create permalink with it enabled :)

gnerred commented 9 years ago

Thanks @kalbermattenm !

sbrunner commented 9 years ago

done