Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

MapView drawing shapes
Started by claes.lindblom Dec 17 2014 10:26 AM

8 replies to this topic
mapview
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

claes.lindblom

[GLOBAL: userInfoPane.html]
claes.lindblom
  • Observer

  • 27 posts
  • Corona SDK

I have a business case where I would need to draw shapes on a MapView.

The primary need is polylines but polygons and circles would also be great to have.

 

I don't want to create a hybrid app with html and JavaScript in a Webview.

 

Google Maps offers Polyline, polygons and circles and you can specify fill color, stroke color and width.

 

I'm afraid I have to look at another cross-platform solution but if Corona makes this possible I would use Corona without a doubt.

 

What are the plans for Corona SDK to improve MapView to something really useful that a lot of developers would benefit from?

 



[TOPIC: post.html]
#2

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @claes.lindblom,

From the Corona SDK standpoint, the mapView is a native object, so OpenGL images/objects can't be drawn over top. However, I do believe this would be possible using CoronaCards, where you could have different "views" overlaying each other. So basically, I'm not sure how much we are able to do in terms of the native map view on the SDK side.

 

Best regards,

Brent



[TOPIC: post.html]
#3

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Here's a workaround idea. It might work if your shapes are fixed in size. You could draw them as png files and save them in your project folder. Then when you need to overlay them on your map simply create a mapMarker in a given location and use the appropriate shape as your marker image file. I think you can make do in this manner until a better solution becomes available. 

 

+1 for better mapView support.



[TOPIC: post.html]
#4

claes.lindblom

[GLOBAL: userInfoPane.html]
claes.lindblom
  • Observer

  • 27 posts
  • Corona SDK

Hi @Brent,

Yes I know I cannot draw on a mapView so what I'm looking for is the same as for adding a marker on the map using the native map component to draw on a map layer. I have worked with Maps in native Android development I it should not be a too difficult task to add a few extra functions to extend the native map API to Corona SDK.

 

In Google Maps API v2 its quite easy for Android.

map.addPolyline(new PolylineOptions().geodesic(true)
                .add(new LatLng(-33.866, 151.195))  // Sydney
                .add(new LatLng(-18.142, 178.431))  // Fiji
                .add(new LatLng(21.291, -157.821))  // Hawaii
                .add(new LatLng(37.423, -122.091))  // Mountain View 

also changing color and width of the polyline

Polyline line = map.addPolyline(new PolylineOptions()
    .add(new LatLng(-37.81319, 144.96298), new LatLng(-31.95285, 115.85734))
    .width(25)
    .color(Color.BLUE)
    .geodesic(true));

https://developers.google.com/maps/documentation/android/shapes#polylines

 

I'm really hoping that this will happen soon for Corona SDK, it would be a huge improvement for business Apps  :)



[TOPIC: post.html]
#5

claes.lindblom

[GLOBAL: userInfoPane.html]
claes.lindblom
  • Observer

  • 27 posts
  • Corona SDK

@ksan,

The shape size is fixed for a particular scale on the map but when zooming in/out on the map it might be tricky to keep it correct.

I will look into this idea some more and see if its possible. Thanks!



[TOPIC: post.html]
#6

lokeshkumawat27

[GLOBAL: userInfoPane.html]
lokeshkumawat27
  • Observer

  • 19 posts
  • Corona SDK

i have to draw line on mapView ?

 

myMap:addMarker( event.latitude, event.longitude)

 

this is only indicate the point but i wants to replace this point to on line.



[TOPIC: post.html]
#7

claes.lindblom

[GLOBAL: userInfoPane.html]
claes.lindblom
  • Observer

  • 27 posts
  • Corona SDK

Seems like there is no luck with MapView.

 

The closest I have come is to use Google Maps Static API which can deliver an image of an area with markers and routes but the downside is that its not easy to implement zooming and panning.

 

I really hope Corona SDK will be enhanced with more native API's for Android and iOS otherwise business apps will loose ground compared to eg. Titanium SDK which delivers native apps with JavaScript instead of Lua.



[TOPIC: post.html]
#8

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

I really hope Corona SDK will be enhanced with more native API's for Android and iOS otherwise business apps will loose ground compared to eg. Titanium SDK which delivers native apps with JavaScript instead of Lua.


Glad you saw the light. Titanium is there already. Corona Labs is not even making the promise to get there eventually with regards to these features. Its not even a comparison. If you care about your time and energy jump ship. Cut your losses and move on. For business apps there really is no point sticking around.

[TOPIC: post.html]
#9

pspk

[GLOBAL: userInfoPane.html]
pspk
  • Observer

  • 15 posts
  • Corona SDK

I have similar needs with the Map API on Android. But more importantly, my biggest issue is that it has such poor performance that it makes my Android app unusable. Though this has been discussed in other forums, I wanted to mention this to give it more exposure. Given that Android is the dominant platform for the international userbase I am targeting, the maps performance issue has become a showstopper for me. I've invested over three years on the app I've been developing and to have to shift to another platform at this point is a major effort. Corona has to realize that if people like me leave, it will be the tip of an exodus iceberg.

 

The irony is that I think it only requires a small amount of work on Corona's part to fix major pain points like the Android map implementation - after all, the IOS implementation works superbly. And then keep adding cool stuff on top of it - and you will have a loyal developer base for years to come. To me, the next few months are going to be a crucial judge of the priorities of Corona post merger... 




[topic_controls]
[/topic_controls]