# Error code 3004 in localhost (and then error 3099)

**URL:** <https://ask.openrouteservice.org/t/error-code-3004-in-localhost-and-then-error-3099/4889>\
**Category:** python\
**Created:** [May 19, 2023, 9:12pm UTC](https://ask.openrouteservice.org/t/error-code-3004-in-localhost-and-then-error-3099/4889 "2023-05-19T21:12:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattiascalas](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/mattiascalas/32/1938_2.png) [@mattiascalas](https://ask.openrouteservice.org/u/mattiascalas)\
**Post date:** [May 19, 2023, 9:12pm UTC](https://ask.openrouteservice.org/t/error-code-3004-in-localhost-and-then-error-3099/4889/1 "2023-05-19T21:12:53Z")

</div>

I’m trying to combine multiple processing in one python code, so I’m switching from QGIS to an Anaconda environment. I already have correctly deployed my local server, and some tests are doing well:

```auto
import openrouteservice

# Initialize the client with the correct base_url
client = openrouteservice.Client(base_url='http://localhost:8080/ors')

# Define the coordinates
coords = [(7.680929, 45.070339), (7.672074, 45.071198)]

# Make the directions request
response = client.directions(
    coordinates=coords,
    profile='foot-walking'
)

# Check if 'routes' key exists in the response
if 'routes' in response:
    print("Connection successful", response)
else:
    print("Connection failed:", response)

```

Anyway, when I tried to add a shapefile as an input, I got an error. Here is my code:

```auto
import openrouteservice
import geopandas as gpd

# Initialize the client with the correct base_url
client = openrouteservice.Client(base_url='http://localhost:8080/ors')

# Read the input shapefile
shapefile_path = 'mypath/.shp'
gdf = gpd.read_file(shapefile_path)

# Extract the coordinates from the shapefile
coords = [(point.x, point.y) for point in gdf.geometry]

# Specify the range parameter
range_type = 'time' # or 'distance'
range_value = [120] # in seconds or meters, depending on the range_type

# Make the isochrones request
response = client.isochrones(
    locations=coords,
    profile='foot-walking',
    range_type=range_type,
    range=range_value
)

# Check if 'features' key exists in the response
if 'features' in response:
    print("Connection successful")
    # Process the response as needed
    # ...
else:
    print("Connection failed:", response)

```

Here is the error

```auto
ApiError: 400 ({'error': {'code': 3004, 'message': "Parameter 'locations=144' is out of range. Maximum possible value is 2."}, 'info': {'engine': {'version': '7.0.1', 'build_date': '2023-03-08T12:06:41Z'}, 'timestamp': 1684530655990}})

```

It seems like ORS is doing like I was accessing the online API

---

<div class="post-metadata">

**Author:** ![mattiascalas](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/mattiascalas/32/1938_2.png) [@mattiascalas](https://ask.openrouteservice.org/u/mattiascalas)\
**Post date:** [May 19, 2023, 9:40pm UTC](https://ask.openrouteservice.org/t/error-code-3004-in-localhost-and-then-error-3099/4889/2 "2023-05-19T21:40:49Z")

</div>

I solved the first problem modifying ors-config, line 78

```auto
"maximum_intervals": 10,
        "maximum_locations": 400,
        "allow_compute_area": true
      },

```

Now the problem is this one

```auto
---------------------------------------------------------------------------
ApiError Traceback (most recent call last)
Cell In[135], line 19
     16 range_value = [120] # in seconds or meters, depending on the range_type
     18 # Make the isochrones request
---> 19 response = client.isochrones(
     20 locations=coords,
     21 profile='foot-walking',
     22 range_type=range_type,
     23 range=range_value
     24 )
     26 # Check if 'features' key exists in the response
     27 if 'features' in response:

File ~\anaconda3\envs\qgis_env\Lib\site-packages\openrouteservice\client.py:299, in _make_api_method.<locals>.wrapper(*args, **kwargs)
    296 @functools.wraps(func)
    297 def wrapper(*args, **kwargs):
    298 args[0]._extra_params = kwargs.pop("extra_params", None)
--> 299 result = func(*args, **kwargs)
    300 try:
    301 del args[0]._extra_params

File ~\anaconda3\envs\qgis_env\Lib\site-packages\openrouteservice\isochrones.py:132, in isochrones(client, locations, profile, range_type, range, intervals, segments, interval, units, location_type, smoothing, attributes, validate, dry_run)
    129 if attributes:
    130 params["attributes"] = attributes
--> 132 return client.request("/v2/isochrones/" + profile + '/geojson', {}, post_json=params, dry_run=dry_run)

File ~\anaconda3\envs\qgis_env\Lib\site-packages\openrouteservice\client.py:204, in Client.request(self, url, get_params, first_request_time, retry_counter, requests_kwargs, post_json, dry_run)
    200 return self.request(url, get_params, first_request_time,
    201 retry_counter + 1, requests_kwargs, post_json)
    203 try:
--> 204 result = self._get_body(response)
    206 return result
    207 except exceptions._RetriableRequest as e:

File ~\anaconda3\envs\qgis_env\Lib\site-packages\openrouteservice\client.py:242, in Client._get_body(response)
    237 raise exceptions._OverQueryLimit(
    238 status_code,
    239 body
    240 )
    241 if status_code != 200:
--> 242 raise exceptions.ApiError(
    243 status_code,
    244 body
    245 )
    247 return body

ApiError: 500 ({'error': {'code': 3099, 'message': 'Unable to build an isochrone map.'}, 'info': {'engine': {'version': '7.0.1', 'build_date': '2023-03-08T12:06:41Z'}, 'timestamp': 1684531907686}})

```

I’m suspecting that can be a coordinate problem reading from the shapefile, can it be?

---

<div class="post-metadata">

**Author:** ![mattiascalas](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/mattiascalas/32/1938_2.png) [@mattiascalas](https://ask.openrouteservice.org/u/mattiascalas)\
**Post date:** [May 19, 2023, 10:40pm UTC](https://ask.openrouteservice.org/t/error-code-3004-in-localhost-and-then-error-3099/4889/3 "2023-05-19T22:40:27Z")

</div>

Again, solved. It was a problem with the original input file. Now I ask, is there a way to make ORS ignore the features with errors?

---

<div class="post-metadata">

**Author:** ![amandus](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/amandus/32/669_2.png) [@amandus](https://ask.openrouteservice.org/u/amandus)\
**Post date:** [May 24, 2023, 1:36pm UTC](https://ask.openrouteservice.org/t/error-code-3004-in-localhost-and-then-error-3099/4889/4 "2023-05-24T13:36:05Z")

</div>

Hi @mattiascalas,

if you have a local ors instance you are not bound by query limits. You could just send 1 request per center and ignore the ones with errors and merge the outputs afterwards (if you need them as a single geojson).

Ignoring faulty features is currently not possible. But you could open an issue in our [backend repo](https://github.com/GIScience/openrouteservice/issues/) for that.

Best regards
