Coder Social home page Coder Social logo

geoswift's Introduction

GEOSwift

Swift Package Manager Compatible CocoaPods Compatible Supported Platforms Build Status

Easily handle a geometric object model (points, linestrings, polygons etc.) and related topological operations (intersections, overlapping etc.). A type-safe, MIT-licensed Swift interface to the OSGeo's GEOS library routines.

For MapKit integration visit: https://github.com/GEOSwift/GEOSwiftMapKit
For MapboxGL integration visit: https://github.com/GEOSwift/GEOSwiftMapboxGL

Migrating to Version 5 or Later

Version 5 constitutes a ground-up rewrite of GEOSwift. For full details and help migrating from version 4, see VERSION_5.md.

Features

  • A pure-Swift, type-safe, optional-aware programming interface
  • WKT and WKB reading & writing
  • Robust support for GeoJSON via Codable
  • Thread-safe
  • Swift-native error handling
  • Extensively tested

Requirements

  • iOS 9.0+, tvOS 9.0+, macOS 10.9+, watchOS 2.0+ (Swift Package Manager, CocoaPods)
  • Linux (Swift Package Manager)
  • Swift 5.5

GEOS is licensed under LGPL 2.1 and its compatibility with static linking is at least controversial. Use of geos without dynamic linking is discouraged.

Installation

CocoaPods

  1. Update your Podfile to include:

     use_frameworks!
     pod 'GEOSwift'
    
  2. Run $ pod install

Swift Package Manager

  1. Update the top-level dependencies in your Package.swift to include:

     .package(url: "https://github.com/GEOSwift/GEOSwift.git", from: "10.1.0")
    
  2. Update the target dependencies in your Package.swift to include

     "GEOSwift"
    

In certain cases, you may also need to explicitly include geos as a dependency. See issue #195 for details.

Usage

Geometry creation

// 1. From Well Known Text (WKT) representation
let point = try Point(wkt: "POINT(10 45)")
let polygon = try Geometry(wkt: "POLYGON((35 10, 45 45.5, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))")

// 2. From a Well Known Binary (WKB)
let wkb: NSData = geometryWKB()
let geometry2 = try Geometry(wkb: wkb)

// 3. From a GeoJSON file:
let decoder = JSONDecoder()
if let geoJSONURL = Bundle.main.url(forResource: "multipolygon", withExtension: "geojson"),
    let data = try? Data(contentsOf: geoJSONURL),
    let geoJSON = try? decoder.decode(GeoJSON.self, from: data),
    case let .feature(feature) = geoJSON,
    let italy = feature.geometry
{
    italy
}

Topological operations

Let's say we have two geometries:

Example geometries

GEOSwift let you perform a set of operations on these two geometries:

Topological operations

Predicates:

  • equals: returns true if this geometric object is “spatially equal” to another geometry.
  • disjoint: returns true if this geometric object is “spatially disjoint” from another geometry.
  • intersects: returns true if this geometric object “spatially intersects” another geometry.
  • touches: returns true if this geometric object “spatially touches” another geometry.
  • crosses: returns true if this geometric object “spatially crosses’ another geometry.
  • within: returns true if this geometric object is “spatially within” another geometry.
  • contains: returns true if this geometric object “spatially contains” another geometry.
  • overlaps: returns true if this geometric object “spatially overlaps” another geometry.
  • relate: returns true if this geometric object is spatially related to another geometry by testing for intersections between the interior, boundary and exterior of the two geometric objects as specified by the values in the intersectionPatternMatrix.

Playground

Explore more, interactively, in the playground, which is available in the GEOSwiftMapKit project. It can be found inside GEOSwiftMapKit workspace. Open the workspace in Xcode, build the GEOSwiftMapKit framework and open the playground file.

Playground

Contributing

To make a contribution:

  • Fork the repo
  • Start from the main branch and create a branch with a name that describes your contribution
  • Run $ xed Package.swift to open the project in Xcode.
  • Run $ swiftlint from the repo root and resolve any issues.
  • Push your branch and create a pull request to main
  • One of the maintainers will review your code and may request changes
  • If your pull request is accepted, one of the maintainers should update the changelog before merging it

Maintainer

Past Maintainers

License

  • GEOSwift was released by Andrea Cremaschi (@andreacremaschi) under a MIT license. See LICENSE for more information.
  • GEOS stands for Geometry Engine - Open Source, and is a C++ library, ported from the Java Topology Suite. GEOS implements the OpenGIS Simple Features for SQL spatial predicate functions and spatial operators. GEOS, now an OSGeo project, was initially developed and maintained by Refractions Research of Victoria, Canada.

geoswift's People

Contributors

alexander-prokopchuk avatar andreacremaschi avatar arvinkx avatar ccorn90 avatar ghecho avatar guidohendriks avatar heikkihautala avatar johncrenshaw avatar johnson-christopher avatar jwilson85 avatar kinergy avatar macdrevx avatar madhavajay avatar oroom avatar paul-aigue avatar pjleonard37 avatar rccoop avatar readmecritic avatar rugheid avatar samritchie avatar sauvikated avatar simonedamico avatar ssokol avatar vfn 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  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

geoswift's Issues

intersection not reported correctly

I think I've encountered a problem with the intersection function. See sample code and output below. I compute two intersections with a LinearRing, one for each of two LineStrings (l1 and l2). The intersection method returns a single point for l1 (let's call it p1) and no intersection for l2. However, as you can see in the output, the first point of l2 has the exact same coordinates as p1!! Since p1 is on the polygon and is also on l2, shouldn't it be returned by the call to intersection between l2 and the polygon?

Output:

------------------------------
LINESTRING (-93.22021411377627 41.02901854527665, -93.21658311574629 41.03020949145205)
INTERSECTION WITH POLYGON:
     POINT (-93.21758591425403 41.02988057939051)
------------------------------
LINESTRING (-93.21758591425403 41.02988057939051, -93.22099602915671 41.02797278078819)
INTERSECTION WITH POLYGON:
     GEOMETRYCOLLECTION EMPTY

Code:

    func showIntersectionError() {
        let wkt = "LINEARRING (-93.22013091198183 41.02908541733761, -93.22119394432185 41.02823102274288, -93.21985273529471 41.02648097815198, -93.2194752097908 41.02827599115583, -93.21617682907213 41.02745531278529, -93.21605761049196 41.02948263210197, -93.21715044747705 41.02926528847117, -93.21777634502303 41.03014964773079, -93.21703122889683 41.03079417326732, -93.22013091198183 41.02908541733761)"
        
        guard let pgon = Geometry.create(wkt) as? LinearRing else {
            print("Can't create polygon")
            return
        }

        let l1 = LineString.create("LINESTRING (-93.22021411377627 41.02901854527665, -93.21658311574629 41.03020949145205)") as! LineString
        let l2 = LineString.create("LINESTRING (-93.21758591425403 41.02988057939051, -93.22099602915671 41.02797278078819)") as! LineString
        
        for l in [ l1, l2 ] {
        
            let i = l.intersection(pgon)

            print("------------------------------")
            print(l.WKT ?? "")
            print("INTERSECTION WITH POLYGON:\n    ", i.WKT ?? "")
            
        }
    }

GEOJSON from String or json resource

Hey there. I'm having an issue and was wondering if GeoSwift can create a MultiPolygon from a string or a json url. Specifically I am getting a shape from a json source that is listed below.
"shape": [
[
[
[ -84.321797, 34.988965 ],
[ -84.308201, 35.092843 ],
[ -84.30696, 35.106162 ],
[ -84.297721, 35.169478 ],
[ -84.294723, 35.185594 ],
[ -84.29024, 35.225572 ],
[ -84.289921, 35.225585 ],
[ -84.290061, 35.225257 ],
[ -84.289621, 35.224677 ],
[ -84.288516, 35.224391 ],
[ -84.28712, 35.224877 ],
[ -84.28512, 35.226577 ],
[ -84.28322, 35.226577 ],
[ -84.28152, 35.229277 ],
[ -84.27792, 35.231477 ],
[ -84.27702, 35.233177 ],
[ -84.27662, 35.233277 ],
... truncated ..
],
... truncated ...
]
]
any thoughts?

Memory Leak suspicion

I have a geofencing app which create Waypoint at about every second.
I that case memory usage continuously grow till the OOM. Checked on the emulator and real devices.

(Geometry.deinit is called by the system)

Add sample Examples

It is hard to grasp the first implementation of the framework. A sample project or examples would facilitate this understanding.

Thank you.

Problems arise when using LinearRing convenience initializer

First off, thank you, this library is amazing! Here's the issue I found.

The convenience initializer LinearRing(points: [Coordinate]) gives you back a LinearRing object but not quite a valid one. This is evident in its WKT which describes itself as a LINESTRING. It also causes errors in methods that expect a valid LinearRing, such as the convenience initializer
Polygon(shell: LinearRing, holes: Array<LinearRing>?).

Some sample code and output follows to help illustrate the problem. If I take the LinearRing's WKT, replace LINESTRING with LINEARRING, and pass it to Geometry.create(), I end up with a valid LinearRing.

    func showLinearRingError() {
        
        let origin = MKMapPointForCoordinate(CLLocationCoordinate2D(latitude: 37.9505544833345, longitude: -100.990952407583))

        var mapPoints = [MKMapPoint]()

        mapPoints.append(origin)
        mapPoints.append(MKMapPoint(x:origin.x+10000,y:origin.y+20000))
        mapPoints.append(MKMapPoint(x:origin.x,y:origin.y+20000))
        mapPoints.append(origin)

        let coords = mapPoints.map({ (mp: MKMapPoint) -> Coordinate in
            return CoordinateFromCLLocationCoordinate2D(MKCoordinateForMapPoint(mp))
            })
        
        print(String(describing: coords))
        
        guard let lr1 = LinearRing(points: coords) else {
            print("LR1 failed")
            return
        }
        
        print("-------- LR1 ---------")
        print(String(describing: lr1))

        guard let wkt1 = lr1.WKT else {
            print ("Couldn't get WKT for LR1");
            return
        }
        print(wkt1)
        print("----------------------")
        
        let wkt_new = wkt1.replacingOccurrences(of: "LINESTRING", with: "LINEARRING")
        
        print("NEW WKT = " + wkt_new)
        
        guard let lr2 = Geometry.create(wkt_new) as? LinearRing else {
            print("LR2 failed")
            return
        }
        print("-------- LR2 ---------")
        print(String(describing: lr2))
        
        guard let wkt2 = lr2.WKT else {
            print ("Couldn't get WKT for LR2");
            return
        }
        print(wkt2)
        print("----------------------")
        
        if let polygon1 = Polygon(shell: lr1, holes: nil) {
            print("Created polygon using shell lr1")
            print(String(describing: polygon1))
        }
        else {
            print("Cannot create polygon using shell lr1")
        }

        if let polygon2 = Polygon(shell: lr2, holes: nil) {
            print("Created polygon using shell lr2")
            print(String(describing: polygon2))
        }
        else {
            print("Cannot create polygon using shell lr2")
        }
    }

Output:

[GEOSwift.Coordinate(x: -100.99095240758299, y: 37.950554483334486), GEOSwift.Coordinate(x: -100.97754136250853, y: 37.92940110061317), GEOSwift.Coordinate(x: -100.99095240758299, y: 37.92940110061317), GEOSwift.Coordinate(x: -100.99095240758299, y: 37.950554483334486)]
-------- LR1 ---------
<GEOSwift.LinearRing: 0x608000484420>
LINESTRING (-100.990952407583 37.95055448333449, -100.9775413625085 37.92940110061317, -100.990952407583 37.92940110061317, -100.990952407583 37.95055448333449)
----------------------
NEW WKT = LINEARRING (-100.990952407583 37.95055448333449, -100.9775413625085 37.92940110061317, -100.990952407583 37.92940110061317, -100.990952407583 37.95055448333449)
-------- LR2 ---------
<GEOSwift.LinearRing: 0x600000284f60>
LINEARRING (-100.990952407583 37.95055448333449, -100.9775413625085 37.92940110061317, -100.990952407583 37.92940110061317, -100.990952407583 37.95055448333449)
----------------------
GEOSwift # %s.
Cannot create polygon using shell lr1
Created polygon using shell lr2
<GEOSwift.Polygon: 0x600000285370>

Problem trying to display MultiPolygon as an overlay

multipolygon.geojson.zip

In the code below the line if let geo = geometries?[0] as? MultiPolygon { is giving me the following error:

Generic parameter 'T' count not be inferred in case to 'MultiPolygon<_>'

Xcode 8.3 prompts me to change MultiPolygon to MultiPolygon<Polygon> but execution never makes it past this 'if' statement when I update it.

Any ideas? I'm relatively new to Swift.

Thank you!

func addOverlay() {
    if let geoJSONURL = Bundle.main.url(forResource: "multipolygon", withExtension: "geojson") {
        do {
            let geometries = try Geometry.fromGeoJSON(geoJSONURL)
            if let geo = geometries?[0] as? MultiPolygon {
                if let shapesCollection = geo.mapShape() as? MKShapesCollection {
                    let shapes = shapesCollection.shapes
                    for shape in shapes {
                        if let polygon = shape as? MKPolygon {
                            mapView.add(polygon)
                        }
                    }
                }
            }
        } catch {
            print("Unable to load geojson data")
        }
    }
}

Cocoa Pods Error

Like below

[!] /bin/bash -c
set -e
type -P autoconf &>/dev/null || alias autoconf 'xcrun autoconf'
type -P autoheader &>/dev/null || alias autoheader 'xcrun autoheader'
type -P aclocal &>/dev/null || alias aclocal 'xcrun aclocal'
type -P automake &>/dev/null || alias automake 'xcrun automake'
type -P glibtool &>/dev/null || alias glibtool 'xcrun glibtool'
type -P glibtoolize &>/dev/null || alias glibtoolize 'xcrun glibtoolize'

sh autogen.sh
./configure
./tools/svn_repo_revision.sh

sed -i "" "s/\/\* #undef HAVE_INT64_T_64 \*\//#define HAVE_INT64_T_64 1/" include/geos/platform.h
sed -i "" "s/#define HAVE_LONG_INT_64 1/\/\* #undef HAVE_LONG_INT_64 \*\//" include/geos/platform.h

cat <<EOT >> include/geos/platform.h
  #undef ISNAN
  #define ISNAN(x) (std::isnan(x))
EOT

patch capi/geos_c.h <<EOF
  149c149
  < #include <geos/export.h>
  ---
  > #define GEOS_DLL
EOF

/bin/bash: line 2: alias: autoconf: not found
/bin/bash: line 2: alias: xcrun autoconf: not found

geos install issue

Hey I'm trying to run a pod install and keep getting the following crash:

[!] /bin/bash -c
set -e
type -P autoconf &>/dev/null || alias autoconf 'xcrun autoconf'
type -P autoheader &>/dev/null || alias autoheader 'xcrun autoheader'
type -P aclocal &>/dev/null || alias aclocal 'xcrun aclocal'
type -P automake &>/dev/null || alias automake 'xcrun automake'
type -P glibtool &>/dev/null || alias glibtool 'xcrun glibtool'
type -P glibtoolize &>/dev/null || alias glibtoolize 'xcrun glibtoolize'

sh autogen.sh
./configure
./tools/svn_repo_revision.sh

sed -i "" "s//* #undef HAVE_INT64_T_64 //#define HAVE_INT64_T_64 1/" include/geos/platform.h
sed -i "" "s/#define HAVE_LONG_INT_64 1//
#undef HAVE_LONG_INT_64 *//" include/geos/platform.h

cat <> include/geos/platform.h
#undef ISNAN
#define ISNAN(x) (std::isnan(x))
EOT

patch capi/geos_c.h <<EOF
149c149
< #include <geos/export.h>


define GEOS_DLL

EOF

/bin/bash: line 2: alias: autoconf: not found
/bin/bash: line 2: alias: xcrun autoconf: not found

Crossing lines when drawing polygons causes crash when getting intersection

I am having a problem where If I draw, and my lines cross, when I try to get the intersection of that polygon + my screenbounds, my app is crashing - unwrapping a nil value.

▿ Optional

  • some : "LINESTRING (-104.949991020116 39.7341442768165, -104.876498956624 39.7341442768165, -104.876498956624 39.6537682983905, -104.949991020116 39.6537682983905, -104.949991020116 39.7341442768165)"

(lldb) po secondPolygon.boundary().WKT
▿ Optional

  • some : "LINESTRING (-104.944111655036 39.7035600061908, -104.944111655036 39.7035600061908, -104.94384498837 39.7047909710371, -104.94224498837 39.7065348003118, -104.93784498837 39.7103300410915, -104.93544498837 39.7124840037951, -104.930378321703 39.7157661033518, -104.92784498837 39.7172019728002, -104.922778321703 39.7197659510379, -104.91984498837 39.7207915156434, -104.915711655036 39.7216119563467, -104.911711655036 39.7218170649975, -104.90744498837 39.7218170649975, -104.902378321703 39.721099182051, -104.899978321703 39.7203812916313, -104.893578321703 39.7175096552216, -104.891711655036 39.7163814796327, -104.88984498837 39.7151507215805, -104.888111655036 39.7137148094297, -104.886911655036 39.7125865717701, -104.88544498837 39.7110480361321, -104.884378321703 39.7095094661807, -104.88344498837 39.7077657120885, -104.882778321703 39.7058167583008, -104.882511655036 39.7040729108788, -104.882378321703 39.7021238527825, -104.882378321703 39.6994566314414, -104.882378321703 39.6968918983224, -104.882778321703 39.693916688505, -104.883578321703 39.6909413504461, -104.88424498837 39.6874528597565, -104.884778321703 39.6851955071468, -104.885978321703 39.6818093398587, -104.886911655036 39.6795518027524, -104.88784498837 39.6776020522271, -104.88904498837 39.6756522466599, -104.890511655036 39.6739076371285, -104.891978321703 39.6723682391853, -104.893978321703 39.6708288069372, -104.89624498837 39.6692893403849, -104.898911655036 39.6680577424441, -104.90144498837 39.6669287583787, -104.903578321703 39.6663129411131, -104.905978321703 39.6661076674715, -104.908378321703 39.6661076674715, -104.910911655036 39.6661076674715, -104.913311655036 39.6661076674715, -104.915578321703 39.6668261225489, -104.917711655036 39.6674419352408, -104.91984498837 39.6683656439876, -104.92184498837 39.6693919725556, -104.92504498837 39.6706235467123, -104.927311655036 39.6721629835342, -104.928911655036 39.6733945082924, -104.93064498837 39.6748312594281, -104.931978321703 39.6762679806801, -104.93304498837 39.6776020522271, -104.933711655036 39.6788334800153, -104.934378321703 39.6799622695335, -104.935178321703 39.6810910406025, -104.935711655036 39.6823224061818, -104.936111655036 39.6836563607821, -104.936511655036 39.6846824621705, -104.936911655036 39.6856059403833, -104.937178321703 39.6864267995373, -104.93744498837 39.6873502544208, -104.93784498837 39.6881710928374, -104.93824498837 39.6889919214953, -104.93864498837 39.6898127403944, -104.939178321703 39.6906335495345, -104.939711655036 39.6915569481522, -104.94024498837 39.6924803344186, -104.940378321703 39.6931985151977, -104.94064498837 39.693916688505, -104.940778321703 39.6944296648642, -104.940911655036 39.6949426374112, -104.94104498837 39.695353012704, -104.941311655036 39.6956607925725, -104.941311655036 39.695763385557, -104.94144498837 39.695763385557, -104.941711655036 39.695763385557, -104.94184498837 39.695763385557, -104.941978321703 39.695763385557, -104.942111655036 39.6960711635956, -104.94264498837 39.6964815321789, -104.944111655036 39.7035600061908)"

It never gets through the first line of this function:

func intersection(_ geometry: Geometry) -> Geometry  {
    let intersectionGEOM = GEOSIntersection_r(GEOS_HANDLE, self.geometry, geometry.geometry)!
    let intersection = Geometry.create(intersectionGEOM, destroyOnDeinit: true)!
    return intersection
}

despite my ability to print out each of the objects - GEOS_HANDLE, self.geometry, and geometry.geometry without any nil values.

I also tried modifying this function with if lets, and those won't stop it from throwing the same exception and crashing.

Swift 3

it'd be cool to have a swift 3 version, if you have any interest to create a branch i would like to help with that.

MultiPolygon mapShape crash

When attempting to generate a shape from a MultiPolygon instance, the following crash happens in the switch's default case:

Could not cast value of type 'GEOSwift.MultiPolygon<GEOSwift.Polygon>' (0x11e22d030) to 'GEOSwift.GeometryCollection<GEOSwift.Geometry>' (0x11e22c230).

The commit Homely@13988a1 fixes the problem. Unfortunately I could not find a way to handle that on a generic fashion. I'm happy to change the code if a better solution exists.

A test multipolygon can be found at: https://gist.github.com/vfn/6c932835dee0ae3f2111#file-multipoligon-wkt

How to calculate area of a polygon?

I have created a GEOSwift polygon from a geojson object. I want to calculate it's area. I do not see a method exposed. Is there a GeoSwift function to do that?

Pod install error

Hi. I am new at apple. i can't solve this. When i write pod install it gives error. When i delete pod geoswift it works. My podfile
source 'https://github.com/CocoaPods/Spces.git'
platform :ios, '8.0'
use_frameworks!

pod 'Alamofire', '~> 3.0'
pod 'GEOSwift'

How to retreive extra info from the geojson file?

Here is part of my geojson:

{
"type": "FeatureCollection",
"name": "Parks",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "JOB_NUM": "LTAGDMDM20090406-001", "TYP_CD": "PRKC", "PRK_NAM": "JURONG WEST PARK CONNECTOR", "CRT_USRID_": "TANCK6", "CRT_DTTM": "2009\/04\/07", "LAST_UPD_U": "TANCK6", "LAST_UPD_D": "2009\/04\/07", "PKG_REF": null, "SHAPE_Leng": 378.88054856700001, "SHAPE_Area": 314.519120601 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 103.698224452375712, 1.339871148362099 ], [ 103.69822148901477, 1.339887050855704 ], [ 103.699879230297284, 1.340195969305389 ], [ 103.699884104057233, 1.340182519647963 ], [ 103.698224452375712, 1.339871148362099 ] ] ] ] } },

I'd like to get extra info like TYP_CD and PRK_NAM etc, what should I do? Thanks.

Circle functionality?

Loving this framework, makes parsing GeoJSON so much simpler!

Looking to extend the functionality in here by adding support for circles. GeoJSON doesn't strictly have a "Circle" feature however convention states that you create a Point and then in the properties for the feature you have the radius.

Happy to submit a PR but just wondering where the best place to start would be.

Cheers

How to create an Polygon Object from list of CLLocationCoordinate2D

Hey Guys,

I am currently trying to create Geometry Objects from a list a CLLocationCoordinate2D-Objects.
This is my approach:

import Foundation
import MapKit
import GEOSwift

class MyPolygon {
	var coordinates: [CLLocationCoordinate2D] = []
	init(coordinates: [CLLocationCoordinate2D]) {
		self.coordinates = coordinates
	}
	
	var geoPolygon: Polygon {
		let pairs: [String] = coordinates.flatMap { String("\($0.latitude)) \($0.longitude )")}
		let joined = pairs.joined(separator: ", ")
		return Polygon(WKT: "POLYGON((\(joined)))")!
	}
}

The joined String could look like this:

"POLYGON((51.0693791021764 9.75201444533336, 51.1328987236114 9.67614867733331, 51.2121755537486 9.58763861466671, 51.2517628689227 9.56235002533339, 51.2913161313519 9.53706143599998, 51.3466335100652 9.52441714133342, 51.4334260815772 9.51177284666666, 51.5200540729691 9.48648425733335, 51.6457648636909 9.46119566800003, 51.7554766499544 9.42326278399996, 51.8414922247152 9.39797419466664, 51.9585218712106 9.39797419466664, 52.0052483952469 9.39797419466664, 52.0519261862681 9.4106184893334, 52.1063220425348 9.44855137333327, 52.1373756320464 9.499128552, 52.1528943136927 9.52441714133342, 52.168407587594 9.57499432000005, 52.1761621968738 9.61292720400002, 52.1916673605595 9.67614867733331, 52.2304066207189 9.8278802133333, 52.2768491510004 9.99225604400005, 52.3000521840339 10.1692761693334, 52.3232430657399 10.3210077053333, 52.3232430657399 10.4600949466667, 52.3232430657399 10.599182188, 52.3232430657399 10.6876922506667, 52.3232430657399 10.8141351973333, 52.3155141218271 10.864712376, 52.2923191899635 10.940578144, 52.2613737103096 10.9911553226667, 52.2381504193787 11.016443912, 52.2226614710605 11.0417325013333, 52.1761621968738 11.09230968, 52.1373756320464 11.1175982693334, 52.0985552641519 11.1555311533334, 52.036372336149 11.206108332, 51.9585218712106 11.2440412160001, 51.9039459736845 11.2566855106666, 51.8571137937767 11.2819741, 51.7711280511801 11.2946183946667, 51.6692969280776 11.2946183946667, 51.5750953384108 11.2946183946667, 51.512185598856 11.2946183946667, 51.4649462056936 11.2946183946667, 51.4097717070348 11.2693298053334, 51.3782134946566 11.2440412160001, 51.3308353514949 11.2187526266667, 51.2596762452943 11.1555311533334, 51.1963310905783 11.1049539746667, 51.1328987236114 11.054376796, 51.0932091880119 11.0037996173334, 51.0693791021764 10.978511028, 51.053485558395 10.9532224386667, 51.0375865579418 10.9152895546667, 51.0216821001682 10.8773566706667, 51.0137278245838 10.8267794920001, 51.0137278245838 10.8014909026667, 51.0137278245838 10.750913724, 50.9978151796162 10.6876922506667, 50.9898568100717 10.6371150720001, 50.9739359764586 10.5865378933334, 50.9500444885243 10.4600949466667, 50.9420779288883 10.4221620626667, 50.9181700578872 10.3589405893333, 50.91019803659 10.3210077053333, 50.9022246496782 10.2324976426666, 50.9022246496782 10.1692761693334, 50.9022246496782 10.1313432853334, 50.9022246496782 10.068121812, 50.9022246496782 10.0175446333334, 50.9022246496782 9.97961174933329, 50.9181700578872 9.916390276, 50.9261407136496 9.87845739200003, 50.9420779288883 9.84052450800006, 50.9420779288883 9.81523591866664, 50.9500444885243 9.80259162399999, 50.9500444885243 9.78994732933333, 50.9580096829447 9.78994732933333, 50.9580096829447 9.77730303466667, 50.9659735122294 9.77730303466667, 50.9739359764586 9.77730303466667, 50.9818970757127 9.77730303466667))"

For some reason the Polygon Object can not be created.
Is this the wrong way to create Polygon Objects from a list of CLLocationCoordinate2D?
What I am doing wrong? I would really appreciate if you guys can help me with that.

Thanks in advance.

Pod geos 3.4.2a causes iTunes Connect rejection

Is it possible to update the podspec for lib GEOS, to a version that doesn't contain a letter. The current version 3.4.2a generates the following error when submitting to iTunes Connect:

ERROR ITMS-90060: "This bundle is invalid. The value for key CFBundleShortVersionString '3.4.2a' in the Info.plist file must be a period-separated list of at most three non-negative integers.

ITMS-90060 invalid bundle id

The geos dependency of 3.4.2a prevents submission to the app store. I’ll take a stab at fixing it and opening a PR.

screen shot 2015-11-13 at 08 29 01

Error while the first build

I'm a newbie and there are several errors when building my project after installing GEOS with pod

Errors come in fun generate() in GEOS.swift

return AnyGenerator:"Argument passed to call that takes no arguments"
guard index < self.count else { return nil} "Type of expression is ambiguous without more context"

BTW, i'm working on it with OSX10.10.5 and Xcode 7.2
Thanks~

Build using Carthage?

Hi,

This looks like fantastic work! I am trying to integrate into an app where I am using Carthage as my framework manager — it's a little more lightweight than CocoaPods. I am wondering if it is possible to configure this for Carthage...I tried installing it and there was some cryptic (to me) error which I have pasted below. Perhaps this just means that there needs to be a Cartfile in the project directory specifying dependencies (MapBox iOS SDK?). Might be...anyway, insight from other interested parties would be appreciated.

Thanks,
Daven

*** Building scheme "GEOSwift" in GEOSwift.xcworkspace
Build Failed
	Task failed with exit code 65:
	/usr/bin/xcrun xcodebuild -workspace "/Users/Daven/Development/Mapping App/Map-Digitizer/Carthage/Checkouts/GEOSwift/GEOSwift.xcworkspace" -scheme GEOSwift -configuration Release -derivedDataPath /Users/Daven/Library/Caches/org.carthage.CarthageKit/DerivedData/GEOSwift/f5a631fe99cdac1fd72fd680763b8cf952a9aed6 -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/md/lvb3zv4n5652ffl6t44397t80000gn/T/carthage-xcodebuild.l8D67B.log

Only GeoJSON FeatureCollection?

It looks like the GeoJSON parsing only works if you have a FeatureCollection? The GeoJSON I use does not use that. It has a type of Feature. I can send you some samples if that helps.

Thanks!

GeoJSON Feature properties

I see there has been some (uncommeted) properties handling. But it would be really nice to be able to handle GeoJSON features with that library too.

Requesting Features: overlay for Heat Map, and Hot Spot Map

Requesting Features: overlay for Heat Map, and Hot Spot Map.
I am work on a project that related to represent map datas as Heat map or Hot spot map by customized the overlay render delegate in MKMap. Currently I am using image for specific region, the problem is the quality of image, if too large the app crush, if too small after zoom in many times the image become blur. It would be great if anyone could help suggest me some options. Thanks.

Can't install pod

hi, i'm using the latest version of CocoaPods but the install process fails.
here's my output:

[!] /bin/bash -c 
set -e
type -P autoconf &>/dev/null || alias autoconf 'xcrun autoconf'
type -P autoheader &>/dev/null || alias autoheader 'xcrun autoheader'
type -P aclocal &>/dev/null || alias aclocal 'xcrun aclocal'
type -P automake &>/dev/null || alias automake 'xcrun automake'
type -P glibtool &>/dev/null || alias glibtool 'xcrun glibtool'
type -P glibtoolize &>/dev/null || alias glibtoolize 'xcrun glibtoolize'

sh autogen.sh
./configure
./tools/svn_repo_revision.sh

sed -i "" "s/\/\* #undef HAVE_INT64_T_64 \*\//#define HAVE_INT64_T_64 1/" include/geos/platform.h
sed -i "" "s/#define HAVE_LONG_INT_64 1/\/\* #undef HAVE_LONG_INT_64 \*\//" include/geos/platform.h

cat <<EOT >> include/geos/platform.h
  #undef ISNAN
  #define ISNAN(x) (std::isnan(x))
EOT

patch capi/geos_c.h <<EOF
  149c149
  < #include <geos/export.h>
 \---
  \> #define GEOS_DLL
EOF

/bin/bash: line 2: alias: autoconf: not found
/bin/bash: line 2: alias: xcrun autoconf: not found

Getting odd output from swiftCallback??

I'm using the library with Swift 3 on iOS 10.3.2. Everything seems to be working correctly, but I keep getting odd messages in the debug output:

GEOSwift # %s.
GEOSwift # %s.
GEOSwift # %s.
GEOSwift # %s.

Looks like that is coming from the swiftCallback function, defined at the top of GEOS.swift:

let swiftCallback : GEOSCallbackFunction = { args -> Void in
    if let string = String(validatingUTF8: args.assumingMemoryBound(to: CChar.self)) {
        print("GEOSwift # " + string + ".")
    }
}

Does this indicate any sort of error? If not, is it acceptable if I comment out the print statement?

Thanks!

union of 2 polygons in mapbox

If I am correct we cannot do union of 2 MGL polygons in Mapbox. Are there any plans to add this? I guess it is possible in mapkit.

Also if someone knows a possible way to find union of multiple polygons such that final polygon can contain holes? Please do let me know. Thanks

Pod Install Issues

Hey there I am trying to install GEOSwift and I am getting this error when it is installing the geos pod:

Installing GEOSwift (2.1.0)
Installing geos (3.5.0)
[!] /bin/bash -c
set -e
type -P autoconf &>/dev/null || alias autoconf 'xcrun autoconf'
type -P autoheader &>/dev/null || alias autoheader 'xcrun autoheader'
type -P aclocal &>/dev/null || alias aclocal 'xcrun aclocal'
type -P automake &>/dev/null || alias automake 'xcrun automake'
type -P glibtool &>/dev/null || alias glibtool 'xcrun glibtool'
type -P glibtoolize &>/dev/null || alias glibtoolize 'xcrun glibtoolize'

sh autogen.sh
./configure
./tools/svn_repo_revision.sh

sed -i "" "s//* #undef HAVE_INT64_T_64 *//#define HAVE_INT64_T_64 1/" include/geos/platform.h
sed -i "" "s/#define HAVE_LONG_INT_64 1//* #undef HAVE_LONG_INT_64 *//" include/geos/platform.h

cat <> include/geos/platform.h
#undef ISNAN
#define ISNAN(x) (std::isnan(x))
EOT

patch capi/geos_c.h <<EOF
149c149
< #include <geos/export.h>

#define GEOS_DLL
EOF

/bin/bash: line 2: alias: autoconf: not found
/bin/bash: line 2: alias: xcrun autoconf: not found

I have installed autoconf, automake, and libtool, they are in my home directory. I have installed using the coocapods app as well as in terminal. I am running it on Xcode 9.0.1 and running the latest version of cocoapods (not the beta). Any thoughts?

Failed to build on xcode 9

I am trying to add GEOSwift to xcode 9, I am using swift version 3.2, and when I build it I get an error:

Showing Recent Issues
-1: unable to build node: '/Users/idanaviv/Library/Developer/Xcode/DerivedData/Mapit-bzfzfkmrqlfkroczgpyrzczwflze/Build/Products/Debug-iphonesimulator/GEOSwift/GEOSwift.framework/Info.plist' (node is produced by multiple commands; e.g., '88b8ceef99a0f83e40520894e5900ab26746848abd41793ca5ed3c9d64e390f4:CopyPlistFile /Users/idanaviv/Library/Developer/Xcode/DerivedData/Mapit-bzfzfkmrqlfkroczgpyrzczwflze/Build/Products/Debug-iphonesimulator/GEOSwift/GEOSwift.framework/Info.plist /Users/idanaviv/programming/Mapit/Pods/GEOSwift/GEOSwift/Info.plist' and '88b8ceef99a0f83e40520894e5900ab26746848abd41793ca5ed3c9d64e390f4:ProcessInfoPlistFile /Users/idanaviv/Library/Developer/Xcode/DerivedData/Mapit-bzfzfkmrqlfkroczgpyrzczwflze/Build/Products/Debug-iphonesimulator/GEOSwift/GEOSwift.framework/Info.plist /Users/idanaviv/programming/Mapit/Pods/Target Support Files/GEOSwift/Info.plist')

AGSGeometry Support

Hi, Would be huge feature if Esri Arcgis IOS SDK supported.

Cannot use geometry in arcgis, as it requires a different format as AGSGeometry.

Xcode 7.2 code completion

Hi,

I'm trying to use this pod in my project, but cannot get autocompletion in Swift to work using cocoa pods 0.39.0 (also tried 1.0.0.beta3).
Can somebody confirm that it works in their project?
If yes, are there some specific search header paths that need to be included?

I have successfully built GEOSwift on the develop branch (master seems broken), and code completion works in the playground.

Best way to split a polygon?

I have polygons derived from geojson files displaying on mapkit. It works great! But I need to split the multipolygons into two groups so I can color them individually. I thought I might accomplish it by doing the following:

  1. Figure out the enclosing rectangle of the shapesCollection
  2. Divide it into two rectangles
  3. Take each rectangle and "intersect" it with the multipolygon (creating two overlays)
  4. render each overlay with a different color

This is what I have that works well for displaying one or move overlays in a geojson file:

func addOverlay(url:URL?) {
    if let geoJSONURL = url {
        do {
            let features = try Geometry.fromGeoJSON(geoJSONURL)
            if let geo = features?.first?.geometries?.first as? MultiPolygon<Polygon> {
                if let shapesCollection = geo.mapShape() as? MKShapesCollection {
                    var regionRectShapes = shapesCollection.boundingMapRect // added this to account for multiple objects
                    
                    let shapes = shapesCollection.shapes
                    for shape in shapes {
                        if let polygon = shape as? MKPolygon {
                            mapView.add(polygon)
                        }
                    }
                    mapView.setRegion(MKCoordinateRegionForMapRect(regionRectShapes), animated: true)
                }
            }
        } catch {
            print("error")
        }
    }
}

But where do I go from here? I can calculate and create a new rectangle/polygon that covers half of the enclosing rectangle (regionRectShapes) like so:

let regionRectHeight = regionRectShapes.size.height
let regionRectOriginY = regionRectShapes.origin.y
let regionRectNewY = regionRectOriginY + (regionRectHeight / 2)
                
let northOverlayPoint = MKMapPointMake(MKMapRectGetMinX(regionRectShapes), regionRectNewY)
let southOverlayPoint = MKMapPointMake(MKMapRectGetMaxX(regionRectShapes), regionRectNewY)
let eastOverlayPoint = MKMapPointMake(MKMapRectGetMaxX(regionRectShapes), regionRectShapes.origin.y)
let westOverlayPoint = MKMapPointMake(MKMapRectGetMinX(regionRectShapes), regionRectShapes.origin.y)
                
// this polygon covers half of the 'regionRectShapes' rectangle and displays properly
var points: [MKMapPoint] = [northOverlayPoint, southOverlayPoint, eastOverlayPoint, westOverlayPoint]
let polygonBox = MKPolygon(points: points, count: points.count)

But then the intersection operation between it and the geo object doesn't work because it requires WKT geometry. I tried creating a WKT of the same rectangle using lat/long as the values but that doesn't work either. Apparently I'm creating the WKT incorrectly because it shows up nil.

let northOverlayPointCoordinate = MKCoordinateForMapPoint(northOverlayPoint)
let southOverlayPointCoordinate = MKCoordinateForMapPoint(southOverlayPoint)
let eastOverlayPointCoordinate = MKCoordinateForMapPoint(eastOverlayPoint)
let westOverlayPointCoordinate = MKCoordinateForMapPoint(westOverlayPoint)

let upperRect = Geometry.create("POLYGON(\(northOverlayPointCoordinate.latitude) \(northOverlayPointCoordinate.longitude), \(southOverlayPointCoordinate.latitude) \(southOverlayPointCoordinate.longitude), \(eastOverlayPointCoordinate.latitude) \(eastOverlayPointCoordinate.longitude), \(westOverlayPointCoordinate.latitude) \(westOverlayPointCoordinate.longitude), \(northOverlayPointCoordinate.latitude) \(northOverlayPointCoordinate.longitude))")
                
let upperRectIntersection = geo.intersection(upperRect!) <-- failure

Would appreciate any ideas! Perhaps I'm going about this all wrong.

Thanks

Install issue

Hi,

I have a fresh install of Xcode. I change dependencies in Podfile
I got the autoconf not found error then I install brew install autoconf automake libtool
After relâche pod install, I got the following error (I tried pod update too):

set -e
type -P autoconf &>/dev/null || alias autoconf 'xcrun autoconf'
type -P autoheader &>/dev/null || alias autoheader 'xcrun autoheader'
type -P aclocal &>/dev/null || alias aclocal 'xcrun aclocal'
type -P automake &>/dev/null || alias automake 'xcrun automake'
type -P glibtool &>/dev/null || alias glibtool 'xcrun glibtool'
type -P glibtoolize &>/dev/null || alias glibtoolize 'xcrun glibtoolize'

sh autogen.sh
./configure
./tools/svn_repo_revision.sh

sed -i "" "s/\/\* #undef HAVE_INT64_T_64 \*\//#define HAVE_INT64_T_64 1/" include/geos/platform.h
sed -i "" "s/#define HAVE_LONG_INT_64 1/\/\* #undef HAVE_LONG_INT_64 \*\//" include/geos/platform.h

cat <<EOT >> include/geos/platform.h
  #undef ISNAN
  #define ISNAN(x) (std::isnan(x))
EOT

patch capi/geos_c.h <<EOF
  149c149
  < #include <geos/export.h>
  ---
  > #define GEOS_DLL
EOF

* Running /usr/local/bin/glibtoolize (2.4.6)
   OPTIONS = --force --copy
glibtoolize: putting auxiliary files in '.'.
glibtoolize: copying file './ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'macros'.
glibtoolize: copying file 'macros/libtool.m4'
glibtoolize: copying file 'macros/ltoptions.m4'
glibtoolize: copying file 'macros/ltsugar.m4'
glibtoolize: copying file 'macros/ltversion.m4'
glibtoolize: copying file 'macros/lt~obsolete.m4'
* Running /usr/local/bin/aclocal (1.15.1)
* Running /usr/local/bin/autoheader (2.69)
* Running /usr/local/bin/automake (1.15.1)
   OPTIONS = --add-missing --copy -Woverride
* Running /usr/local/bin/autoconf (2.69)
======================================
Now you are ready to run './configure'
======================================
checking build system type... x86_64-apple-darwin17.2.0
checking host system type... x86_64-apple-darwin17.2.0
checking target system type... x86_64-apple-darwin17.2.0
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin17.2.0 file names to x86_64-apple-darwin17.2.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin17.2.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... yes
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking for library containing strerror... none required
checking whether make sets $(MAKE)... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking whether closedir returns void... no
checking for working memcmp... yes
checking for strftime... yes
checking for vprintf... yes
checking for _doprnt... no
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for dirent.h that defines DIR... (cached) yes
checking for library containing opendir... (cached) none required
checking for ANSI C header files... (cached) yes
checking for memory.h... (cached) yes
checking for unistd.h... (cached) yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for strchr... yes
checking for memcpy... yes
checking for gettimeofday... yes
checking whether stat file-mode macros are broken... no
checking whether struct tm is in sys/time.h or time.h... time.h
checking for size_t... (cached) yes
checking for an ANSI C-conforming const... yes
checking if requested to force inline functions... yes
checking if requested to enable assert macros... yes
checking if requested libstdc++ debug mode... no
checking if g++ supports -pedantic... yes
checking if g++ supports -Wall... yes
checking if g++ supports -ansi... yes
checking if g++ supports -Wno-long-long... yes
checking if g++ supports -ffloat-store... no
checking for finite... yes
checking for isfinite... yes
checking for isnan... yes
checking whether int64_t is 64 bits... no
checking whether long long int is 64 bits... yes
checking OS-specific settings... darwin17.2.0
checking for OS/X version... Mac OS X (Darwin 17.2.0 kernel)
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating capi/Makefile
config.status: creating capi/geos_c.h
config.status: creating doc/Doxyfile
config.status: creating doc/Makefile
config.status: creating macros/Makefile
config.status: creating src/Makefile
config.status: creating src/algorithm/Makefile
config.status: creating src/algorithm/locate/Makefile
config.status: creating src/algorithm/distance/Makefile
config.status: creating src/geom/Makefile
config.status: creating src/geom/prep/Makefile
config.status: creating src/geom/util/Makefile
config.status: creating src/geomgraph/Makefile
config.status: creating src/geomgraph/index/Makefile
config.status: creating include/Makefile
config.status: creating include/geos/Makefile
config.status: creating include/geos/algorithm/Makefile
config.status: creating include/geos/algorithm/locate/Makefile
config.status: creating include/geos/algorithm/distance/Makefile
config.status: creating include/geos/geom/Makefile
config.status: creating include/geos/geom/prep/Makefile
config.status: creating include/geos/geom/util/Makefile
config.status: creating include/geos/geomgraph/Makefile
config.status: creating include/geos/geomgraph/index/Makefile
config.status: creating include/geos/index/Makefile
config.status: creating include/geos/index/bintree/Makefile
config.status: creating include/geos/index/chain/Makefile
config.status: creating include/geos/index/intervalrtree/Makefile
config.status: creating include/geos/index/quadtree/Makefile
config.status: creating include/geos/index/strtree/Makefile
config.status: creating include/geos/index/sweepline/Makefile
config.status: creating include/geos/io/Makefile
config.status: creating include/geos/linearref/Makefile
config.status: creating include/geos/noding/Makefile
config.status: creating include/geos/noding/snapround/Makefile
config.status: creating include/geos/operation/Makefile
config.status: creating include/geos/operation/buffer/Makefile
config.status: creating include/geos/operation/distance/Makefile
config.status: creating include/geos/operation/intersection/Makefile
config.status: creating include/geos/operation/linemerge/Makefile
config.status: creating include/geos/operation/overlay/Makefile
config.status: creating include/geos/operation/overlay/snap/Makefile
config.status: creating include/geos/operation/polygonize/Makefile
config.status: creating include/geos/operation/predicate/Makefile
config.status: creating include/geos/operation/relate/Makefile
config.status: creating include/geos/operation/sharedpaths/Makefile
config.status: creating include/geos/operation/union/Makefile
config.status: creating include/geos/operation/valid/Makefile
config.status: creating include/geos/planargraph/Makefile
config.status: creating include/geos/planargraph/algorithm/Makefile
config.status: creating include/geos/precision/Makefile
config.status: creating include/geos/simplify/Makefile
config.status: creating include/geos/triangulate/Makefile
config.status: creating include/geos/triangulate/quadedge/Makefile
config.status: creating include/geos/util/Makefile
config.status: creating include/geos/version.h
config.status: creating src/index/Makefile
config.status: creating src/index/bintree/Makefile
config.status: creating src/index/chain/Makefile
config.status: creating src/index/intervalrtree/Makefile
config.status: creating src/index/quadtree/Makefile
config.status: creating src/index/strtree/Makefile
config.status: creating src/index/sweepline/Makefile
config.status: creating src/io/Makefile
config.status: creating src/linearref/Makefile
config.status: creating src/noding/Makefile
config.status: creating src/noding/snapround/Makefile
config.status: creating src/operation/Makefile
config.status: creating src/operation/buffer/Makefile
config.status: creating src/operation/distance/Makefile
config.status: creating src/operation/intersection/Makefile
config.status: creating src/operation/linemerge/Makefile
config.status: creating src/operation/overlay/Makefile
config.status: creating src/operation/polygonize/Makefile
config.status: creating src/operation/predicate/Makefile
config.status: creating src/operation/relate/Makefile
config.status: creating src/operation/sharedpaths/Makefile
config.status: creating src/operation/union/Makefile
config.status: creating src/operation/valid/Makefile
config.status: creating src/planargraph/Makefile
config.status: creating src/precision/Makefile
config.status: creating src/simplify/Makefile
config.status: creating src/triangulate/Makefile
config.status: creating src/triangulate/quadedge/Makefile
config.status: creating src/util/Makefile
config.status: creating swig/geos.i
config.status: creating swig/Makefile
config.status: creating swig/python/Makefile
config.status: creating swig/python/tests/Makefile
config.status: creating swig/ruby/Makefile
config.status: creating swig/ruby/test/Makefile
config.status: creating php/Makefile
config.status: creating php/test/Makefile
config.status: creating tests/Makefile
config.status: creating tests/bigtest/Makefile
config.status: creating tests/unit/Makefile
config.status: creating tests/perf/Makefile
config.status: creating tests/perf/operation/Makefile
config.status: creating tests/perf/operation/buffer/Makefile
config.status: creating tests/perf/operation/predicate/Makefile
config.status: creating tests/perf/capi/Makefile
config.status: creating tests/xmltester/Makefile
config.status: creating tests/geostest/Makefile
config.status: creating tests/thread/Makefile
config.status: creating tools/Makefile
config.status: creating tools/geos-config
config.status: creating include/config.h
config.status: creating include/geos/platform.h
config.status: executing depfiles commands
config.status: executing libtool commands
Swig: false
Python bindings: false
Ruby bindings: false
PHP bindings: false
#define GEOS_SVN_REVISION 0
configure.ac:37: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.ac:37: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.ac:40: installing './compile'
configure.ac:9: installing './config.guess'
configure.ac:9: installing './config.sub'
configure.ac:37: installing './install-sh'
configure.ac:37: installing './missing'
capi/Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
swig/python/Makefile.am:18: installing './py-compile'
Can't fetch local revision (neither .svn nor .git found)
Wrote rev '0' in file './geos_svn_revision.h'
sed: can't read s/\/\* #undef HAVE_INT64_T_64 \*\//#define HAVE_INT64_T_64 1/: No such file or directory```

Can't merge user_target_xcconfig for pod targets: ["SVGKit", "geos"].

Hi, guys.

In my project two libraries are very necessary - 'SVGKit', 'GeoSwift' (in addition to him goes 'geos').

I have added to my podfile:
pod 'GEOSwift'
pod 'SVGKit', :git => 'https://github.com/SVGKit/SVGKit.git', :branch => '2.x'

And run 'pod install'. But I receive a error.

[!] Can't merge user_target_xcconfig for pod targets: ["SVGKit", "geos"]. Singular build setting CLANG_CXX_LIBRARY has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["SVGKit", "geos"]. Singular build setting CLANG_CXX_LIBRARY has different values.

Why there is a error?
What can I make?
Help, please.

I tried to lower the SVGKit version and then I have established them. But I have lost in functionality of SVGKit and I can't solve objectives with his help.

error with geos dependency

Getting this error below when I run pod install for GeoSwift:
Im using cocoapods v 1.1.0

Installing geos (3.5.0)
[!] /bin/bash -c
set -e
type -P autoconf &>/dev/null || alias autoconf 'xcrun autoconf'
type -P autoheader &>/dev/null || alias autoheader 'xcrun autoheader'
type -P aclocal &>/dev/null || alias aclocal 'xcrun aclocal'
type -P automake &>/dev/null || alias automake 'xcrun automake'
type -P glibtool &>/dev/null || alias glibtool 'xcrun glibtool'
type -P glibtoolize &>/dev/null || alias glibtoolize 'xcrun glibtoolize'

sh autogen.sh
./configure
./tools/svn_repo_revision.sh

sed -i "" "s/\/\* #undef HAVE_INT64_T_64 \*\//#define HAVE_INT64_T_64 1/" include/geos/platform.h
sed -i "" "s/#define HAVE_LONG_INT_64 1/\/\* #undef HAVE_LONG_INT_64 \*\//" include/geos/platform.h

cat <<EOT >> include/geos/platform.h
  #undef ISNAN
  #define ISNAN(x) (std::isnan(x))
EOT

patch capi/geos_c.h <<EOF
  149c149
  < #include <geos/export.h>
  ---
  > #define GEOS_DLL
EOF

/bin/bash: line 2: alias: autoconf: not found
/bin/bash: line 2: alias: xcrun autoconf: not found

pod geos error

the config.log below is:

configure:3545: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3556: $? = 1
configure:3545: gcc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:3556: $? = 1
configure:3576: checking whether the C compiler works
configure:3598: gcc /usr/local/opt/libxml2/include /usr/local/opt/libxml2/lib conftest.c >&5
ld: can't map file, errno=22 file '/usr/local/opt/libxml2/lib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Cannot get my code to produce an MKPolyline, only MKShape.

Sorry to post this here, but this is the only place where someone might be able to help.

I cant seem to get an MKPolyline out of the function, it always returns an MKShape. Is the correct behaviour? Ive read through the codebase and as far as i understand it it should return a MKPolyline?

Here is my code (this returns the error: Cannot invoke 'add' with an argument list of type '(MKShape)'):

let linestring = LineString(WKT: "LINESTRING(51.063164 -0.728986, 51.072347 -0.723721, 51.116898 -0.731893)") let shapeLine = linestring!.mapShape() self.mapView.add(shapeLine)

If i force downcast it runs, but i still get no polyline:

let linestring = LineString(WKT: "LINESTRING(51.063164 -0.728986, 51.072347 -0.723721, 51.116898 -0.731893)") let shapeLine = linestring!.mapShape() dump(shapeLine) let shapePoly = shapeLine as! MKPolyline self.mapView.add(shapePoly)

I am sure this is incredibly simple, but i cant seem to work out where i am going wrong. Any help would be extremely appreciated.

Alex

Here is the same question i posted on stackoverflow 3 days ago:
https://stackoverflow.com/questions/47342588/require-mkpolyline-but-code-keeps-returning-mkshape
(i wouldnt usually post in multiple places)

Objective-C LineString usage

Hi,
First, let me thanks you for this amazing framework. I've tried many, proprietary or not, but this one is by far the best available for my needs.

I'm trying to integrate it into an Objc app.
Here's what I've got working :

NSString *WKT = @"LINESTRING(5.220477 45.172999, 5.258071 45.160170 , 5.244166 45.169247)"; LineString *linestring = (LineString *)[Geometry create:WKT];

Now, I'd like to get references to first and last point of linestring. Something like

startPoint = linestring.points[0] endPoint = linestring.points[linestring.numberOfPoints-1]

Is this possible ? From what I see, LineString class has a CoordinatesCollection var named points, but I'm unable to access it.

capture d ecran 2017-04-05 a 10 23 53

"difference" function on Geometry multiple Polygones

The diffence function will not work with the following example:

Geometry *newGeometry = [polyEspace union:polymittelland];
newGeometry = [newGeometry union:polyOstschweiz];
newGeometry = [newGeometry union:polyWallis];
newGeometry = [newGeometry union:polyTessin];

Result:
ios-simulator-screen-shot-08 10 2015-11 47 22

The second Geometry:

Geometry* europePoly = [Geometry create:@"POLYGON ((-23.90625 62.59334083012024, -18.984375 32.84267363195431, 34.80468749999999 33.43144133557529, 34.1015625 67.06743335108297, -23.90625 62.59334083012024))"];

Result:
ios-simulator-screen-shot-08 10 2015-11 48 06

Now, i want the difference of this 2 geometries:

newGeometry = [europePoly difference:newGeometry];

but this results in a empty geometry :(

ios-simulator-screen-shot-08 10 2015-11 52 27

but i expect something like that:
res

Is there a bug?

'geos/geos_c.h' file not found

Checked out the code from master, then built from CocoaPods and tried compiling the framework and I'm getting 'geos/geos_c.h' file not found build errors in GEOSwiftCallback.h at Line 9.

I originally had trouble running pod install but followed the instructions in the README and after installing autoconf, automake and glibtool I was able to get pod install working.

I am trying to compile from the .xcworkspace

ParseGEOJSONObject should be a public API

Hi,
I'm wondering why the only way to feed geojson from a library is through a file.
A common case is to parse part of a JSON response, so it would be great to have a public api that takes a dictionary.

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.