Giter VIP home page Giter VIP logo

polyline's People

Contributors

1ec5 avatar erichoracek avatar frederoni avatar gabrielcastro avatar maximalien avatar orxelm avatar raphaelmor avatar s2ler avatar tmcw avatar tomtaylor avatar underrateddev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polyline's Issues

Unable to push to CocoaPods trunk due to watchOS build failiure

Even after #66 and #67, I’m still unable to push to CocoaPods trunk because of the following watchOS build failures:

 -> Polyline (5.0.0)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Building targets in parallel
    - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    - NOTE  | xcodebuild:  note: Planning build
    - NOTE  | xcodebuild:  note: Constructing build description
    - NOTE  | xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | xcodebuild:  note: Using codesigning identity override: 
    - ERROR | [watchOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - ERROR | xcodebuild:  Polyline/Sources/Polyline/Polyline.swift:67:28: error: 'MKPolyline' is unavailable in watchOS
    - NOTE  | xcodebuild:  MapKit.MKPolyline:2:12: note: 'MKPolyline' has been explicitly marked unavailable here
    - ERROR | xcodebuild:  Polyline/Sources/Polyline/Polyline.swift:69:26: error: 'MKPolyline' is unavailable in watchOS
    - ERROR | xcodebuild:  /path/to/Library/Developer/Xcode/DerivedData/App-goywuiviyktyrhbjimdmhbiluvey/Build/Products/Release-watchsimulator/Polyline/Polyline.framework/Modules/module.modulemap:9:12: error: header 'Polyline-Swift.h' not found
    - ERROR | xcodebuild:  /var/folders/cl/8cgpg37n5cl78pjkbpgml94w0000gn/T/CocoaPods-Lint-20201105-33632-l36e5x-Polyline/App/main.swift:1:8: error: could not build Objective-C module 'Polyline'

Analyzed 1 podspec.

It’s as if the !os(watchOS) conditional isn’t working even after #67. I also have no idea what the deal is with Polyline-Swift.h

/cc @frederoni @MaximAlien

Higher precision not reflected in sanity check

I have found that a polyline with 1e7 precision will often fail to decode. After some investigation I think the cause is here:

    if (componentCounter == 6) && ((currentChar & 0x20) == 0x20) {
        throw PolylineError.singleCoordinateDecodingError
    }

The limit of five components is easy to exceed with a higher-precision line.

It would be possible to vary the limit, and quite easy if you were able to move to an integer exponent for the precision argument, but I suggest that you could also safely omit this whole sanity check. Big numbers here are implausible but not invalid :)

"Rebuild from bitcode" fails when exporting from Xcode Organizer with Polyline.framework embedded

I've found that if I include the Polyline library in my iOS project as a framework (built using Carthage), exporting an IPA through Xcode Organizer fails if "Rebuild from Bitcode" is enabled (the default). I have no issue if I copy Polyline.swift into my source tree and use it that way instead of as a framework.

The error message is as follows (log files are attached)
IDEDistribution.standard.log
IDEDistribution.verbose.log
IDEDistributionPipeline.log

:

ipatool failed with an exception: #<CmdSpec::NonZeroExcitException: /Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool exited with pid 68864 exit 1
Stdout:
Debug: SDK path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk
Debug: PATH: ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin', '/Applications/Xcode.app/Contents/Developer/usr/bin']
Debug: Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo
MachoInfo: cd /
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo" "-info" "/var/folders/3d/n22ncn591pbb85z4mz737vg80000gn/T/ipatool20171206-67131-mwd1cb/thinned/armv7/Payload/DriverApp.app/Frameworks/Polyline.framework/Polyline"

when encode list return unknown characters

hello sir,

i try make function for encode list CLLocationCoordiante2D but return string value have more unknown characters like

ljpi@scz`TA???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????@????@??@@

Add the framework to a Swift Cocoa project

Hello there,

I'm trying to add the project to my cocoa project .
Here is my podfile :

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
pod 'Polyline', '~> 2.0'
use_frameworks! 

It works perfectly in the simulator but the project can't be launched on a real iPhone.
The "Polyline" framework is not found. What am I doing wrong ?
I tried to add the framework manually too but it still does not work.

If you have advices it would be great 😎

Increase minimum deployment target to at least iOS 9.0

This library currently deploys backward to iOS 8.0, macOS 10.10.0, tvOS 9.0, and watchOS 2.0. Xcode 12 warns about these minimum deployment targets because they’re too old. Polyline needs to increase the minimum deployment target to at least iOS 9.0 and the equivalent on the other platforms to avoid this warning, which causes any pod based on Polyline to fail to push to CocoaPods trunk by default: mapbox/mapbox-navigation-ios#2666.

s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
s.watchos.deployment_target = "2.0"
s.tvos.deployment_target = "9.0"

"Cannot find type 'LocationCoordinate2D' in scope"

Just tried to manually drag Polyline.swift into my project and I get a list of errors based in the fact that

Cannot find type 'LocationCoordinate2D' in scope

Are LocationCoordinate2D the same as CLLocationCoordinate2D? Is it just defined as an alias outside Polyline.swift?

Thanks for any help.

v3.3.0 has not been released to CocoaPods

@tomtaylor, looks like CocoaPods is still stuck on v3.2.2:

[!] Unable to satisfy the following requirements:

- `Polyline (~> 3.3)` required by `Podfile`

Would you mind pushing v3.3.0 to CocoaPods? I’d like to upgrade MapboxDirections.swift to work with Xcode 8 GM (both Swift 2.3 and Swift 3).

/cc @superpeteblaze

Crashes at -1 value

Hi,

I am playing around with your code to create a polyline, but it crashes with these locations:

var locations12 = [CLLocation(latitude: 37.32721043, longitude: 122.02685069),
CLLocation(latitude: 37.32727259, longitude: 122.02685280),
CLLocation(latitude: 37.32733398, longitude: 122.02684998)]

The intValue at line 112 crashes:

returnString.append(UnicodeScalar(fiveBitComponent))
intValue = intValue >> 5
} while (intValue != 0)

Because the intValue is always -1 and never updated it is an infinitive loop. Can you reproduce this problem with the locations above?

We think because the locations are close to each other. Your sample locations in the tests are working fine.

@raphaelmor

Swift 3.1 compile warning — 'unsafeBitCast' from 'UnsafeRawPointer' to 'UnsafePointer<Int8>'

In the latest Xcode 8.3 beta, I'm getting the following error on line:

https://github.com/raphaelmor/Polyline/blob/master/Polyline/Polyline.swift#L171

let byteArray = unsafeBitCast((data as NSData).bytes, to: UnsafePointer<Int8>.self)
Polyline.swift:160:21: error: 'unsafeBitCast' from 'UnsafeRawPointer' to 'UnsafePointer<Int8>' gives a type to a raw pointer and may lead to undefined behavior
    let byteArray = unsafeBitCast((data as NSData).bytes, to: UnsafePointer<Int8>.self)
                    ^
Polyline.swift:160:21: note: use the 'assumingMemoryBound' method if the pointer is known to point to an existing value or array of type 'Int8' in memory
    let byteArray = unsafeBitCast((data as NSData).bytes, to: UnsafePointer<Int8>.self)
                    ^~~~~~~~~~~~~~                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                        .assumingMemoryBound(to: Int8.self)
Polyline.swift:160:21: note: use the 'bindMemory' method to assign type 'Int8' to uninitialized raw memory
    let byteArray = unsafeBitCast((data as NSData).bytes, to: UnsafePointer<Int8>.self)
                    ^~~~~~~~~~~~~~                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                        .bindMemory(to: Int8.self, capacity: <#capacity#>)

The compiler is suggesting it should be rewritten as:

let byteArray = (data as NSData).bytes.assumingMemoryBound(to: Int8.self)

Does this seem reasonable? I can open a pull request with these changes if desired.

Polyline(encodedPolyline: encodedPolyline) slow

I have a problem with slow decoding with Polyline(encodedPolyline: encodedPolyline). Even an encoded polyline for a route around 30km takes several seconds, and if I try with a longer route, it can take minutes, sometimes I have a feeling it get stuck. Encoding a polyline is very fast on the other hand.

Example of an encoded polyline that will take around 3-6 seconds to decode is this:

mbmrIe{gnAdHiCVIm@{NEsDFgAHu@^{C`@sC@_As@eWEoBIw@?QDYd@oB@Uv@eDHOViAPwB@_ACUGQIcDYiIsA{a@EcB?iBD]JyBV}C@GJKDOv@k@DCJBJCHIDc@GUEIJaH?}EN{@Le@T_@`EdAdAJhB^P?LGJMNYf@{Bn@_Cp@yCj@oDJu@Lk@JY\\w@MOQUYcAKi@G{APsFNqI?SGkA@m@AUeKmUcKoZkGkQkCiIgCuJuAuEgDeNgEuRgIq[yEeQo@yCmBaK_@cAcDoNwDuRoCaOaDkP}A}GoAcFyAqFyAcFiCcIsC{Hep@}_B{N{^EMS{@_@mAeAiC{@gCk@uBs@qDi@kFIqAc@uEm@wCCKOi@GMmAuBaAmAeAs@a@Qy@Qa@CcBLeAZs@d@]\\aDzDYVaLhPgAjAaCrBs@bAcBrAqDbCaD`B{B|@}DpAyBb@mEh@qDLgCA_Ic@u{@gGqISiB?kGLoI`@stAbI{L`@oINuI@o`AQ_EB{CH{DPiIx@}Fz@cGpAgEfAkkAz_@_DnAiCnA}CbBoBjA}EpDoC~B}AxAgDnD}CtDcDpE}A|BiClEcDdGmB`EkAnC{BvFgDvJ_AbDkB`HaBxGeAbFw@xD_AtFky@neFCP_@fAo@dCq@tBa@v@o@`AqAbAuDjAYNUZIRQv@?h@AR}@fBsDv@}@@c@WkE{e@{AkOwCcRuLgq@sCwPs@eDi[g}@_Wmq@KUYv@sB`E{C|EUZWNs@VS?k@Me@W_@YUYe@_Aq@kBuLia@qAyDQ}@]_AeFmQ]y@kEcOuAaFy@aDeK}[}AaHyD}OcAaFcAmImBwN

Swift 3 Migration

Hi,

I use the MapboxDirections framework, which in turn uses Polyline.
I am migrating my app in preparation for Swift 3 and wondering if you are planning on doing the same for Polyline.

Perhaps I could help and open a PR for Swift 3?

Pete

Not working encoded strings from Open Routing Machine

I tried this string

}gqefAridwgFrYEAhfA{@jDsAxBoBzBaDtB{iAX{c@EsU]uf@?_WR~@tPlTFfg@?jUNj|@eBtu@K?z]cAjLkDlJuFjGyG`IyCjIsAlM?|k@v@|dArQbv@k@jIpA?

and it didnt output the right coordinates. I did divide them by 10 and i got the right coordinates just before adding them to the CLLocationCoordinate2D array

Facing an issues with PolyLine

[!] Unable to satisfy the following requirements:

  • Polyline (~> 4.2.0) required by Podfile
  • Polyline (= 4.1.1) required by MapboxDirections.swift (0.12.0)

Error updating Carthage

When running carthage update I'm having this error on the terminal

A shell task (/usr/bin/xcrun xcodebuild -project /Users/VictorAlejandria/Developer/Projects/Viantti/Viantti/Carthage/Checkouts/Polyline/Polyline.xcodeproj -scheme PolylineTV -configuration Release -sdk appletvos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **

The following build commands failed:
CompileSwift normal arm64 /Users/VictorAlejandria/Developer/Projects/Viantti/Viantti/Carthage/Checkouts/Polyline/Polyline/Polyline.swift
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)

Any help.

Polyline is looking for a new maintainer

I won't have much time in the future to work on Polyline.
So I'm looking for someone who's willing to maintain it.

Polyline is pretty much feature complete and working well.

I think the only thing necessary would be to be sure it still works on future releases of Swift.

If you're interested, contact me here or on twitter :)

"# has been removed from Swift".

I got this problem raised at many places. I try removing these "#" and the application no longer draws polylines. Please help.

Zero-length polyline decodes as only one coordinate

Decoding a zero-length polyline consisting of two coincident endpoints returns an array of only one CLLocationCoordinate2D, which would be a malformed line string:

decodePolyline("s{byuArigzhF", precision: 1e6)
▿ Optional<LineString>
  ▿ some : LineString
    ▿ coordinates : 1 element
      ▿ 0 : CLLocationCoordinate2D
        - latitude : 45.516746
        - longitude : -122.605738

By comparison, the @mapbox/polyline 1.1.0 NPM package decodes the same string to GeoJSON as a line string with two coordinates:

polyline.decode('s{byuArigzhF', 6);
{"type":"LineString","coordinates":[[-122.605738,45.516746],[-122.605738,45.51674]]}
Loading

Swift 4 -

Hey, just wanted to let you know this doesn't compile on Swift 4 with the following issue:
Polyline.swift:334:29: 'subscript' is unavailable for the following code:
encodedString = encodedString[encodedString.index(after: currentIndex)..<encodedString.endIndex]
Apparently substring was obsoleted.

Issue with Highway drive

from @Erulezz

I am simulating an Highway drive with the Simulator and saving all the coordinates. What it normally >should do is follow the complete highway in the San Francisco Bay area, but i'm getting polylines >back like this:

{zbFtdzgVnCbsALfALfALfANhANhANfANfANhANhANdANfANhANfALbALfANhANfALhALfABjAFhABjA@jA?jACjAEjAIjAKjAMhAQhASfAWfAYfAYfAYfAYfAYfAWdAWfAYdAWfAUhAQhAOfAMhAKhAIjAEhACjAAjA@jABjADhAFjAHhAJhALhAJhALfALjALhALjALhAJhAJhAHdAFfABfA@dA?dACfAEfAGdAIdAMdAOdAQdAUdAWbAYbA[A]@?@|@c@z@e@x@g@x@i@t@k@v@k@v@k@v@i@t@i@t@g@t@g@v@g@v@e@x@c@z@a@z@c@z@c@|@c@z@a@|@A@|@c@@A@|@A@|@?@z@c@|@A@|@A@z@a@|@?@|@A@@]z@]@]@?@A[@]|@?@@?@|@A@|@c@x@e@v@g@t@g@n@i@p@i@n@i@p@g@l@i@p@i@n@g@l@i@n@e@p@e@r@c@t@a@t@?@x@?@x@[|@[@y|@[A[A[bA[bA[bA]bA[A]bA[bA[dA[bA[A[A]A]|@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@o@p@o@n@o@n@o@n@o@n@o@n@o@n@o@l@o@n@o@p@o@n@o@n@o@l@m@n@m@n@m@l@m@n@m@n@m@n@i@p@i@r@g@t@e@t@c@x@c@|@A@z@?@|@[|@[AYAWbAUbAUdAUdAUbAUbAUfAUdAUdAUdAUdAWfAUdAUbAWfAUfAWfAUfAUfAUfAUfAWfAWhAUhAWfAWfAWfAWhAUhAWfAWhAWfAWfAUhAWfAUhAUfAUfAWfAWfAWfA[A]dA?@aa@@c@|@g@z@g@z@i@x@k@t@m@r@o@p@o@n@o@n@o@n@m@l@m@j@k@p@k@t@g@t@g@x@c@v@c@z@?@@]@[@YbAWbAUbAQbAOdAMfAKdAIdAIfAKfAIhAIhAKjAKjAKhAKlAOjAMjAQjAUfAWhA[dA[dA]`Ac@bAe@@e@z@g@x@g@z@g@x@g@x@g@v@g@x@g@x@g@x@g@x@i@z@i@x@g@x@g@x@i@z@i@z@g@z@g@x@i@z@i@z@i@z@i@z@k@z@m@x@m@x@

As you can see the line is getting off the highway. The first 2-3 km or so is correct. If i check the >coordinates saved in the array they are always on the highway, even the last coordinate in the array. >Strange thing is, it doesn't always happen. It is properly some value in the coordinate that is going >wrong or something.

Offer a more functional approach

Expose functions for :

[CLLocationCoordinate2D] -> String
[CLLocation] -> String
[UInt32] -> String

String -> [CLLocationCoordinate2D]
String -> [CLLocation]
String -> [UInt32]

And use them internally for the class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.