Giter Club home page Giter Club logo

services_openstreetmap's Introduction

services_openstreetmap's People

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

services_openstreetmap's Issues

Removing Tag?

Is it possible to remove a Tag from an OSM-object?
The API for changing an object says :
"A full representation of the element as it should be after the update has to be provided."
see here

But if I provide data which does not contain a key/tag anymore it seems to stay in the database.
I would use following procedure:

    $changeset = $osmService->createChangeset();
    $changeset->begin($comment);
    $node = $osmService->getNode($osmID);

    $node->setTags($data);

    $changeset->add($node);
    $changeset->commit();

and $data is an array:

$data = array();
//$data["fax"]  = "+1234567890";
$data["name"]  = "NAME";
$data["city"]  = "LA";

Is that the correct way or am I missing something?

can't install through composer/packagist

I put this into my composer.json:

"require": {
        "kenguest/services-openstreetmap": "dev-master"
    }

But as my composer tries updating itself, it says:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for kenguest/services-openstreetmap dev-master -> satisfiable by kenguest/services-openstreetmap[dev-master].
    - kenguest/services-openstreetmap dev-master requires pear-pear/http_request2 2.0.0 -> no matching package found.

Removing tags is not working

Example:

$changeset = $osm->createChangeset();
$changeset->begin("removed tag");
$node = $osm->getNode($id);
$node->removeTag("note");
$changeset->add($node);
$changeset->commit();

This creates a changeset but the tags of the node remain unchanged.

New Release?

Hey,
are you planning a new release in the next time?

I see your last release was on 18. Dec '13.

Greetings

Again remove Tag(s)?

I installed the version Services_OpenStreetMap-1.0.0RC1.
My task is to edit tags. I found that I can change tags using Object::setTag and Object::setTags. It work fine:

$config = [
    'adapter'     => 'HTTP_Request2_Adapter_Curl',
    'api_version' => '0.6',
    'password'    => 'password',
    'server'      => 'http://my.osm.server',
    'User-Agent'  => 'Services_OpenStreetMap',
    'user'        => 'user',
  ];

  $osm = new Services_OpenStreetMap($config);

  try {
      $node = $osm->getNode(146679);

      if ($node) {
          $changeset = $osm->createChangeset();

          $changeset->begin("Test change tags via API");
          $node->setTags([
            'name'     => 'test API',
            'power'    => 'pole',
          ]);

          $changeset->add($node);

          $changeset->commit();
      }
  }
  catch (Exception $e) {
      echo $e->getMessage();
  }

But I can not delete tags using Object::setAllTags([]), Object::removeTag(s). These methods leave empty changeset.
I found that only the Object::setTag method changes the internal dirty variable, which affects the operations in changesets.

Maybe I'm doing wrong?

How to do error handling?

I tried the examples. Works well, if all input, etc is correct, but if something is not the way it should be, PHP exit with error. Is there any suggested way to catch errors/do controlled error handling?

Oauth 2.0?

is oauth 2.0 supported? if so, can someone give me an example code?
if not, this would be very important!!!

check here:

Please note the Future deprecation of HTTP Basic Auth and OAuth 1.0a announcement: https://www.openstreetmap.org/user/pnorman/diary/401157

March 1st, 2024: New OAuth 1.0a application registrations are disabled. Existing applications will not be impacted. HTTP Basic Auth will not be impacted.
May 1st, 2024: Sysadmins will start brownouts to find applications that are still using OAuth 1.0a or HTTP Basic Auth
June 1st, 2024: OAuth 1.0a and HTTP Basic Auth will be shut down.

https://community.openstreetmap.org/t/oauth-1-0a-and-http-basic-auth-shutdown/108490

Don't use created_by tag on map objects

The created_by tag is no longer in use on nodes/ways/relations. The only place it should be used is changesets. JOSM, P2 and iD all have code that silently strips created_by tags off of any objects a user touches so creating new ones is kind of pointless.

tests/TagsWithSameValueTest.php not adressing the problem

Sorry if the title of this issue sounds a bit harsh. I'm not a native English speaker, so no offense intended. ;)

I have recently submitted issue #12 and you created the TagsWithSameValueTest.php test class for verifying that. I can indeed confirm that my original issue does not occur in this test class.

Puzzled by this, I tried around a bit and found out that my original problem does not occur when creating a new node (This is what's being done in TagsWithSameValueTest.php). It only happens when you are editing an existing node.

The cause of this behaviour is the following:
array_diff($this->getTags(), $set) does compare $this->getTags() and $set.

Values are assigned to $set this way:

$set = array();
            for ($i = 0; $i < $tags->length; $i++) {
                $key = $tags->item($i)->getAttribute('k');
                $val = $tags->item($i)->getAttribute('v');
                $set[$key] = $val;
            }

$set contains the values of an object before your new ChangeSet is applied. Hence when you create a new object, $set is empty and array_diff($this->getTags(), $set) will save two tags with the same value. However, when you're editing an existing object, $set is not empty, and the output of array_diff will indeed not contain two tags with the same value.

I didn't submit a pull request because I'm not sure wether this problem can be replicated without changing "real" data on the OSM database.

Need installation instructions

How is one supposed to figure out how the hell to get the included examples to work?

I have installed composer and run composer.phar install, but nothing works out of the box. OpenStreetMap.php itself has some hard-coded require() calls to libraries installed via composer; even removing those and including the autoloader generated by composer (in the vendor folder) produces other require() errors coming from the libraries themselves (e.g. equire_once(Net/URL2.php): failed to open stream: No such file or directory in /..../examples/vendor/pear/http_request2/HTTP/Request2.php)

So either the composer package information is screwed up, or some instructions are needed in order to set up Services_Openstreetmap properly.

Allowing to create/change two tags with the same value

I noticed that, when opening a changeset with Services_Openstreetmap, creating two tags with exactly the same value is prevented. It's also not possible to change an existing tag to exactly the same value used by another tag.

However, there are certain cases where it does make sense to add two tags with the same value. For example in Ukraine, where most objects are tagged both in Ukrainian and Russian, it is even explicitly suggested to duplicate the Ukrainian name (usually used in the main "name" tag) in name:uk to better distinguish it from Russian names.
Also, wouldn't this above check even prevent objects from having certain names? Imagine a café (tagged as amenity=cafe) being called "cafe" (name=cafe)? I'm sure somewhere in this world, we'll have a café called "cafe" (in exactly this spelling :) ).

Any chance of allowing such edits?
The relevant code is one line, in Services/OpenStreetMap/Object.php in getOsmChangeXml():
$diff = array_diff($this->getTags(), $set);

Composer installer

Hello!

Today I found your project.
But in installation on Ubuntu 14.04 I have problem

sudo pear install Services_OpenStreetMap-0.4.0
could not extract the package.xml file from "/build/php5-FncNNb/php5-5.5.9+dfsg/pear-build-download/Services_OpenStreetMap-0.4.0.tgz"
Download of "pear/Services_OpenStreetMap" succeeded, but it is not a valid package archive

I have solved this
sudo pear install -Z http_request2

Is it modern to produce full composer package and installation instructions for this on readme?

So, my project is based on Yii2, it uses composer install platform. You will have much more installations on shared hosting.

Can't find HTTP/Request2.php

Hello,

I installed your library with Composer. I get this error when trying to run it:

PHP Warning:  require_once(HTTP/Request2.php): failed to open stream: No such file or directory in /home/pierre/www/openvegemap/vendor/kenguest/services-openstreetmap/Services/OpenStreetMap.php on line 19
PHP Fatal error:  require_once(): Failed opening required 'HTTP/Request2.php' (include_path='/home/pierre/www/openvegemap/vendor/pear/pear_exception:/home/pierre/www/openvegemap/vendor/pear/log:/home/pierre/www/openvegemap/vendor/kenguest/services-openstreetmap:.:/usr/share/php:/usr/share/pear') in /home/pierre/www/openvegemap/vendor/kenguest/services-openstreetmap/Services/OpenStreetMap.php on line 19

Here is my code:

<?php
require_once 'vendor/autoload.php';
$osm = new Services_OpenStreetMap();

Dependabot can't resolve your PHP dependency files

Dependabot can't resolve your PHP dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed! 

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

You can mention @dependabot in the comments below to contact the Dependabot team.

Wildcard search

In the current state you can just search for exact key value pairs in the loaded XML/data.
For example: "highway => residential" or "country => FR" in the search-Method.

I dont know if the OSM API has some kind of wildcard search already. But i do know that the Overpass/Turbo API has a Wildcard Search in the form of "key=*" . Overpass Tag Search.

It would be nice if you can perform an wildcard search, like if you want to get all highway-types from an loaded Area.

Disable verify ssl validation

How can I prevent ssl from checking without changing the source code of the class Services_OpenStreetMap_Transport_HTTP?

Now I was able to achieve this only by changing the code :

class Services_OpenStreetMap_Transport_HTTP
    implements Services_OpenStreetMap_Transport
{
...
 public function getResponse(
        $url,
        $method = HTTP_Request2::METHOD_GET,
        $user = null,
        $password = null,
        $body = null,
        array $post_data = null,
        array $headers = null
    ) {
        ...
        $request = $this->getRequest();
        $request->setUrl($url);
        $request->setMethod($method);
        $request->setAdapter($this->getConfig()->getValue('adapter'));

        // my insertion
        $request->setConfig('ssl_verify_peer', FALSE);
        $request->setConfig('ssl_verify_host', FALSE);
        // the end of my insertion
        ...

Changeset and setTag

Hello,

I started using this library (1.0.0RC2), which is really helpful. I can't figure if there is a way yet to change changeset tags. I tried :

$osm = new Services_OpenStreetMap([...]);
$changeset = $osm->createChangeset();
$changeset->begin(...);
$changeset->setTag('host', '...');
...
$changeset->commit();

And defined tags are not applied. I also tried $changeset->add($changeset); to mimic other objects behaviour, but this causes an infinite loop. I'm not sure if setting custom tags on changesets is not permitted yet by the library, or if I missed how to use it.

By reading current code, I understand that most of changeset tags are hard-written in begin method. If this is not supported, one simple solution could be to add a tags parameter to this function and append custom tags to existing ones. One more complex solution could be to handle PUT HTTP call on changesets.

Best regards.

How do I pull this library with composer

Here is my composer.json

"repositories":
[
{
"type": "vcs",
"url": "[email protected]:kenguest/Services_Openstreetmap.git"
}
],
"require": {
"pear/http_request2": "dev-trunk",
"kenguest/services-openstreetmap": "V0.3.1"
},

When I run composer update I get this error

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package kenguest/services-openstreetmap could not be found in any version, there may be a typo in the package name.

Potential causes:

Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

What might be the problem and possible solution.
Thanks

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.